Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #89 from helium/madninja/dupe_txn_ignore
Browse files Browse the repository at this point in the history
Fix duplicate transactions from router
  • Loading branch information
madninja authored Aug 13, 2020
2 parents 40cc8b4 + 5eba5dc commit 0a3f6f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/be_db_block.erl
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ prepare_conn(Conn) ->
[]),
{ok, S3} =
epgsql:parse(Conn, ?S_INSERT_TXN,
"insert into transactions (block, time, hash, type, fields) values ($1, $2, $3, $4, $5)",
[]),
["insert into transactions (block, time, hash, type, fields) values ($1, $2, $3, $4, $5) ",
"on conflict do nothing"
], []),


#{
?S_BLOCK_HEIGHT => S0,
Expand Down Expand Up @@ -115,7 +117,9 @@ q_insert_block(Hash, Block, Ledger, Queries, State=#state{base_secs=BaseSecs}) -
?MAYBE_B64(blockchain_block_v1:snapshot_hash(Block))
],
[{?S_INSERT_BLOCK, Params}
| q_insert_signatures(Block, q_insert_transactions(Block, Queries, Ledger, State), State)].
| q_insert_signatures(Block,
q_insert_transactions(Block, Queries, Ledger, State),
State)].

q_insert_signatures(Block, Queries, #state{}) ->
Height = blockchain_block_v1:height(Block),
Expand Down
5 changes: 3 additions & 2 deletions src/be_db_txn_actor.erl
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ prepare_conn(Conn) ->
{ok, S1} =
epgsql:parse(Conn, ?S_INSERT_ACTOR,
["insert into transaction_actors (block, actor, actor_role, transaction_hash) ",
"values ($1, $2, $3, $4)"],
[]),
"values ($1, $2, $3, $4) ",
"on conflict do nothing"
], []),

#{
?S_INSERT_ACTOR => S1
Expand Down

0 comments on commit 0a3f6f6

Please sign in to comment.