mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-24 15:02:32 +00:00
Modify notifyspent handler to take multiple outpoints.
This commit is contained in:
parent
a4a79387cc
commit
a20fd1ab2c
@ -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…
x
Reference in New Issue
Block a user