Skip to content

Commit

Permalink
Merge pull request #31 from hive-engine/fixBlocklogReplay
Browse files Browse the repository at this point in the history
fix replay with blocklog
  • Loading branch information
bt-cryptomancer authored Jan 15, 2021
2 parents 25c2795 + b95f562 commit 7e17fd9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions plugins/Blockchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const produceNewBlockSync = async (block, callback = null) => {
// the stream parsed transactions from the Hive blockchain
const {
refHiveBlockNumber, refHiveBlockId, prevRefHiveBlockId,
transactions, timestamp, virtualTransactions,
transactions, timestamp, virtualTransactions, replay
} = block;
const newTransactions = [];

Expand All @@ -130,7 +130,7 @@ const produceNewBlockSync = async (block, callback = null) => {
});

// if there are transactions pending we produce a block
if (newTransactions.length > 0 || (virtualTransactions && virtualTransactions.length > 0)) {
if (newTransactions.length > 0 || (virtualTransactions && virtualTransactions.length > 0) || replay) {
await producePendingTransactions(
refHiveBlockNumber, refHiveBlockId, prevRefHiveBlockId, newTransactions, timestamp,
);
Expand Down
3 changes: 2 additions & 1 deletion plugins/Replay.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@ function replayFile(callback) {
finalPrevRefHiveBlockId = hiveBlock.previous;
}

// do not pass over the virtual txs, it will be generated by Blockchain plugin
await sendBlock({
blockNumber,
timestamp,
refHiveBlockNumber,
refHiveBlockId: finalRefHiveBlockId,
prevRefHiveBlockId: finalPrevRefHiveBlockId,
transactions,
virtualTransactions,
replay: true,
});
}
}
Expand Down

0 comments on commit 7e17fd9

Please sign in to comment.