Merge pull request #8372 from mohamedawnallah/deep-copy-transactions-GetBlock

routing: deep copy any transaction we obtain from `GetBlock` call.
This commit is contained in:
Yong
2024-01-15 20:13:00 +08:00
committed by GitHub
11 changed files with 20 additions and 16 deletions

View File

@@ -1168,10 +1168,12 @@ func testListTransactionDetails(miner *rpctest.Harness,
t.Fatalf("err fetching block: %s", err)
}
transactions :=
make(map[chainhash.Hash][]*wire.TxOut, len(fetchedBlock.Transactions))
transactions := make(
map[chainhash.Hash][]*wire.TxOut,
len(fetchedBlock.Transactions),
)
for _, tx := range fetchedBlock.Transactions {
transactions[tx.TxHash()] = tx.TxOut
transactions[tx.TxHash()] = tx.Copy().TxOut
}
blockTxOuts[fetchedBlock.BlockHash()] = transactions