Skip to content

Commit 7457184

Browse files
committed
Throw on an attempt to submit the same transaction twice
1 parent 247b75a commit 7457184

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

packages/cashscript/src/network/MockNetworkProvider.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ export default class MockNetworkProvider implements NetworkProvider {
4545
const transactionBin = hexToBin(txHex);
4646

4747
const txid = binToHex(sha256(sha256(transactionBin)).reverse());
48+
49+
if (this.transactionMap[txid]) {
50+
throw new Error(`Transaction with txid ${txid} was already submitted: txn-mempool-conflict`);
51+
}
52+
4853
this.transactionMap[txid] = txHex;
4954

5055
const decoded = decodeTransaction(transactionBin);

0 commit comments

Comments
 (0)