routing: deep copy any transaciton we obtain from GetBlock call.

This commit is contained in:
Mohamed Awnallah
2024-01-11 17:51:09 +02:00
parent 2f04ce7c6e
commit 99908ed2dc
11 changed files with 20 additions and 16 deletions

View File

@@ -613,7 +613,7 @@ func (b *BitcoindNotifier) confDetailsManually(confRequest chainntnfs.ConfReques
}
return &chainntnfs.TxConfirmation{
Tx: tx,
Tx: tx.Copy(),
BlockHash: blockHash,
BlockHeight: height,
TxIndex: uint32(txIndex),
@@ -874,11 +874,13 @@ func (b *BitcoindNotifier) historicalSpendDetails(
continue
}
txHash := tx.TxHash()
txCopy := tx.Copy()
txHash := txCopy.TxHash()
spendOutPoint := &txCopy.TxIn[inputIdx].PreviousOutPoint
return &chainntnfs.SpendDetail{
SpentOutPoint: &tx.TxIn[inputIdx].PreviousOutPoint,
SpentOutPoint: spendOutPoint,
SpenderTxHash: &txHash,
SpendingTx: tx,
SpendingTx: txCopy,
SpenderInputIndex: inputIdx,
SpendingHeight: int32(height),
}, nil