mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
[NOD-1259] Do not panic on non-protocol errors from RPC (#863)
* [NOD-1259] All rule-errors should be protocol-errors * [NOD-1259] Handle submitting of coinbase transactions properly * Revert "[NOD-1259] All rule-errors should be protocol-errors" This reverts commit 2fd30c185640fcee62030f72ed14654570a1d7c7. * [NOD-1259] Don't panic on non-protocol errors in ProtocolManager.AddTransaction/AddBlock * [NOD-1259] Implement subnetworkid.IsBuiltInOrNative and use where appropriate
This commit is contained in:
parent
32c5cfeaf5
commit
48d498e820
2143
blockdag/dag.go
Normal file
2143
blockdag/dag.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -7,14 +7,16 @@ package blockdag
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/kaspanet/go-secp256k1"
|
||||
"github.com/kaspanet/kaspad/util/mstime"
|
||||
"github.com/pkg/errors"
|
||||
"math"
|
||||
"sort"
|
||||
|
||||
"github.com/kaspanet/kaspad/domain/dagconfig"
|
||||
"github.com/kaspanet/kaspad/domain/txscript"
|
||||
"github.com/kaspanet/kaspad/network/domainmessage"
|
||||
"github.com/kaspanet/kaspad/util/mstime"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/kaspanet/kaspad/domainmessage"
|
||||
"github.com/kaspanet/kaspad/util"
|
||||
"github.com/kaspanet/kaspad/util/daghash"
|
||||
"github.com/kaspanet/kaspad/util/subnetworkid"
|
||||
@ -265,10 +267,7 @@ func checkTransactionPayloadHash(tx *util.Tx) error {
|
||||
func checkGasInBuiltInOrNativeTransactions(tx *util.Tx) error {
|
||||
// Transactions in native, registry and coinbase subnetworks must have Gas = 0
|
||||
msgTx := tx.MsgTx()
|
||||
if (msgTx.SubnetworkID.IsEqual(subnetworkid.SubnetworkIDNative) ||
|
||||
msgTx.SubnetworkID.IsBuiltIn()) &&
|
||||
msgTx.Gas > 0 {
|
||||
|
||||
if msgTx.SubnetworkID.IsBuiltInOrNative() && msgTx.Gas > 0 {
|
||||
return ruleError(ErrInvalidGas, "transaction in the native or "+
|
||||
"registry subnetworks has gas > 0 ")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user