routing: deep copy any transaciton we obtain from GetBlock call.
This commit is contained in:
11 files changed
+20
-16
No files matched your search
@@ -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
|
||||
|
||||
@@ -667,7 +667,7 @@ func (b *BtcdNotifier) confDetailsManually(confRequest chainntnfs.ConfRequest,
|
||||
}
|
||||
|
||||
return &chainntnfs.TxConfirmation{
|
||||
Tx: tx,
|
||||
Tx: tx.Copy(),
|
||||
BlockHash: blockHash,
|
||||
BlockHeight: height,
|
||||
TxIndex: uint32(txIndex),
|
||||
|
||||
@@ -788,7 +788,7 @@ func ConfDetailsFromTxIndex(chainConn TxIndexConn, r ConfRequest,
|
||||
}
|
||||
|
||||
return &TxConfirmation{
|
||||
Tx: &tx,
|
||||
Tx: tx.Copy(),
|
||||
BlockHash: blockHash,
|
||||
BlockHeight: uint32(blockHeight),
|
||||
TxIndex: uint32(txIndex),
|
||||
|
||||
@@ -635,7 +635,7 @@ func (n *NeutrinoNotifier) historicalConfDetails(confRequest chainntnfs.ConfRequ
|
||||
}
|
||||
|
||||
return &chainntnfs.TxConfirmation{
|
||||
Tx: tx.MsgTx(),
|
||||
Tx: tx.MsgTx().Copy(),
|
||||
BlockHash: blockHash,
|
||||
BlockHeight: scanHeight,
|
||||
TxIndex: uint32(i),
|
||||
|
||||
Reference in new issue
Block a user