mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-21 14:04:06 +01:00
lntest/mock: set input index on spend event
This commit is contained in:
parent
a6724c1088
commit
3aa5e650fb
1 changed files with 8 additions and 1 deletions
|
@ -67,13 +67,20 @@ func (s *SpendNotifier) Spend(outpoint *wire.OutPoint, height int32,
|
|||
s.mtx.Lock()
|
||||
defer s.mtx.Unlock()
|
||||
|
||||
var inputIndex uint32
|
||||
for i, in := range txn.TxIn {
|
||||
if in.PreviousOutPoint == *outpoint {
|
||||
inputIndex = uint32(i)
|
||||
}
|
||||
}
|
||||
|
||||
txnHash := txn.TxHash()
|
||||
details := &chainntnfs.SpendDetail{
|
||||
SpentOutPoint: outpoint,
|
||||
SpendingHeight: height,
|
||||
SpendingTx: txn,
|
||||
SpenderTxHash: &txnHash,
|
||||
SpenderInputIndex: outpoint.Index,
|
||||
SpenderInputIndex: inputIndex,
|
||||
}
|
||||
|
||||
// Cache details in case of late registration.
|
||||
|
|
Loading…
Add table
Reference in a new issue