mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
[NOD-36] Convert util.MaxSatoshi to integer (#199)
This commit is contained in:
parent
d62279192a
commit
aacb2ada43
@ -180,7 +180,7 @@ func CheckTransactionSanity(tx *util.Tx, subnetworkID *subnetworkid.SubnetworkID
|
||||
satoshi := txOut.Value
|
||||
if satoshi > util.MaxSatoshi {
|
||||
str := fmt.Sprintf("transaction output value of %d is "+
|
||||
"higher than max allowed value of %f", satoshi,
|
||||
"higher than max allowed value of %d", satoshi,
|
||||
util.MaxSatoshi)
|
||||
return ruleError(ErrBadTxOutValue, str)
|
||||
}
|
||||
@ -191,7 +191,7 @@ func CheckTransactionSanity(tx *util.Tx, subnetworkID *subnetworkid.SubnetworkID
|
||||
newTotalSatoshi := totalSatoshi + satoshi
|
||||
if newTotalSatoshi < totalSatoshi {
|
||||
str := fmt.Sprintf("total value of all transaction "+
|
||||
"outputs exceeds max allowed value of %f",
|
||||
"outputs exceeds max allowed value of %d",
|
||||
util.MaxSatoshi)
|
||||
return ruleError(ErrBadTxOutValue, str)
|
||||
}
|
||||
@ -199,7 +199,7 @@ func CheckTransactionSanity(tx *util.Tx, subnetworkID *subnetworkid.SubnetworkID
|
||||
if totalSatoshi > util.MaxSatoshi {
|
||||
str := fmt.Sprintf("total value of all transaction "+
|
||||
"outputs is %d which is higher than max "+
|
||||
"allowed value of %f", totalSatoshi,
|
||||
"allowed value of %d", totalSatoshi,
|
||||
util.MaxSatoshi)
|
||||
return ruleError(ErrBadTxOutValue, str)
|
||||
}
|
||||
@ -925,7 +925,7 @@ func CheckTransactionInputs(tx *util.Tx, txHeight int32, utxoSet UTXOSet, dagPar
|
||||
originTxSatoshi := entry.Amount()
|
||||
if originTxSatoshi > util.MaxSatoshi {
|
||||
str := fmt.Sprintf("transaction output value of %s is "+
|
||||
"higher than max allowed value of %f",
|
||||
"higher than max allowed value of %d",
|
||||
util.Amount(originTxSatoshi),
|
||||
util.MaxSatoshi)
|
||||
return 0, ruleError(ErrBadTxOutValue, str)
|
||||
@ -940,7 +940,7 @@ func CheckTransactionInputs(tx *util.Tx, txHeight int32, utxoSet UTXOSet, dagPar
|
||||
totalSatoshiIn > util.MaxSatoshi {
|
||||
str := fmt.Sprintf("total value of all transaction "+
|
||||
"inputs is %d which is higher than max "+
|
||||
"allowed value of %f", totalSatoshiIn,
|
||||
"allowed value of %d", totalSatoshiIn,
|
||||
util.MaxSatoshi)
|
||||
return 0, ruleError(ErrBadTxOutValue, str)
|
||||
}
|
||||
|
@ -6,11 +6,11 @@ package util
|
||||
|
||||
const (
|
||||
// SatoshiPerBitcent is the number of satoshi in one bitcoin cent.
|
||||
SatoshiPerBitcent = 1e6
|
||||
SatoshiPerBitcent = 1000000
|
||||
|
||||
// SatoshiPerBitcoin is the number of satoshi in one bitcoin (1 BTC).
|
||||
SatoshiPerBitcoin = 1e8
|
||||
SatoshiPerBitcoin = 100000000
|
||||
|
||||
// MaxSatoshi is the maximum transaction amount allowed in satoshi.
|
||||
MaxSatoshi = 21e6 * SatoshiPerBitcoin
|
||||
MaxSatoshi = 21000000 * SatoshiPerBitcoin
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user