rpc: decode sent raw transactions strictly

This commit is contained in:
Boris Nagaev 2026-06-25 23:45:12 -05:00
parent 81b07f6657
commit 59db835591
No known key found for this signature in database

View file

@ -3441,8 +3441,7 @@ func handleSendRawTransaction(s *rpcServer, cmd interface{}, closeChan <-chan st
if err != nil {
return nil, rpcDecodeHexError(hexStr)
}
var msgTx wire.MsgTx
err = msgTx.Deserialize(bytes.NewReader(serializedTx))
tx, err := btcutil.NewTxFromBytes(serializedTx)
if err != nil {
return nil, &btcjson.RPCError{
Code: btcjson.ErrRPCDeserialization,
@ -3451,7 +3450,6 @@ func handleSendRawTransaction(s *rpcServer, cmd interface{}, closeChan <-chan st
}
// Use 0 for the tag to represent local node.
tx := btcutil.NewTx(&msgTx)
acceptedTxs, err := s.cfg.TxMemPool.ProcessTransaction(tx, false, false, 0)
if err != nil {
// When the error is a rule error, it means the transaction was