Skip to content

Commit ff2c94b

Browse files
committed
#134 fix mempool table
1 parent 585532e commit ff2c94b

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

api/service/transactionApiService.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func (ts *TransactionService) PostTransaction(
166166
ID: tx.ID,
167167
TransactionBytes: txBytes,
168168
ArrivalTimestamp: time.Now().Unix(),
169-
SenderAccountAddress: tx.RecipientAccountAddress,
169+
SenderAccountAddress: tx.SenderAccountAddress,
170170
RecipientAccountAddress: tx.RecipientAccountAddress,
171171
}
172172
if err := ts.MempoolService.ValidateMempoolTransaction(mpTx); err != nil {

common/database/migration.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,17 @@ func (m *Migration) Init() error {
4545
"fee_per_byte" INTEGER,
4646
"arrival_timestamp" INTEGER,
4747
"transaction_bytes" BLOB,
48-
"sender_account_id" BLOB,
49-
"recipient_account_id" BLOB,
50-
PRIMARY KEY("id"),
51-
FOREIGN KEY("sender_account_id") REFERENCES account(id),
52-
FOREIGN KEY("recipient_account_id") REFERENCES account(id)
48+
"sender_account_address" VARCHAR(255),
49+
"recipient_account_address" VARCHAR(255),
50+
PRIMARY KEY("id")
5351
);`,
5452
`
5553
CREATE TABLE IF NOT EXISTS "transaction" (
5654
"id" INTEGER,
5755
"block_id" INTEGER,
5856
"block_height" INTEGER,
59-
"sender_account_address_length" INTEGER,
60-
"sender_account_address" TEXT,
61-
"recipient_account_address_length" INTEGER,
62-
"recipient_account_address" TEXT,
57+
"sender_account_address" VARCHAR(255),
58+
"recipient_account_address" VARCHAR(255),
6359
"transaction_type" INTEGER,
6460
"fee" INTEGER,
6561
"timestamp" INTEGER,

common/query/mempoolQuery.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ type (
3232
func NewMempoolQuery(chaintype contract.ChainType) *MempoolQuery {
3333
return &MempoolQuery{
3434
Fields: []string{
35-
"id", "fee_per_byte", "arrival_timestamp", "transaction_bytes", "sender_account_id",
36-
"recipient_account_id",
35+
"id", "fee_per_byte", "arrival_timestamp", "transaction_bytes", "sender_account_address",
36+
"recipient_account_address",
3737
},
3838
TableName: "mempool",
3939
ChainType: chaintype,

0 commit comments

Comments
 (0)