mirror of
https://github.com/LBRYFoundation/lbcd.git
synced 2025-08-23 17:47:24 +00:00
Modify notifyspent handler to take multiple outpoints.
This commit is contained in:
parent
a4a79387cc
commit
a20fd1ab2c
1 changed files with 13 additions and 8 deletions
|
@ -1419,16 +1419,21 @@ func handleNotifySpent(wsc *wsClient, icmd btcjson.Cmd) (interface{}, *btcjson.E
|
||||||
return nil, &btcjson.ErrInternal
|
return nil, &btcjson.ErrInternal
|
||||||
}
|
}
|
||||||
|
|
||||||
blockHash, err := btcwire.NewShaHashFromStr(cmd.OutPoint.Hash)
|
outpoints := make([]*btcwire.OutPoint, 0, len(cmd.OutPoints))
|
||||||
if err != nil {
|
for i := range cmd.OutPoints {
|
||||||
return nil, &btcjson.Error{
|
blockHash, err := btcwire.NewShaHashFromStr(cmd.OutPoints[i].Hash)
|
||||||
Code: btcjson.ErrParse.Code,
|
if err != nil {
|
||||||
Message: err.Error(),
|
return nil, &btcjson.Error{
|
||||||
|
Code: btcjson.ErrParse.Code,
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
index := cmd.OutPoints[i].Index
|
||||||
|
outpoints = append(outpoints, btcwire.NewOutPoint(blockHash, index))
|
||||||
|
}
|
||||||
|
for _, outpoint := range outpoints {
|
||||||
|
wsc.server.ntfnMgr.RegisterSpentRequest(wsc, outpoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
outpoint := btcwire.NewOutPoint(blockHash, cmd.Index)
|
|
||||||
wsc.server.ntfnMgr.RegisterSpentRequest(wsc, outpoint)
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue