mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-11-26 23:46:08 +00:00
* Create a file * Add tests for lockTime - CLTV scripts conditioned by time and block height * Add a handle for an unhandled error. * Renamed the test file * Fix typo * Add a counter for current block height. * Change variable name * Adds a test for wrong lock time, removed fundingTransaction variable * Fix LockTimeThreshold constant, fix opcodeCheckLockTimeVerify and opcodeCheckSequenceVerify(padding in the end), add support for sequence and lock time number in the script builder, add more checks to the CLTV test. * Call AddData instead of addData. Rename fixedSize to unpaddedSize * Creating wrapper functions to lockTime&sequence numbers that call to a shared function in script builder. Co-authored-by: tal <tal@daglabs.com> Co-authored-by: Ori Newman <orinewman1@gmail.com>
50 lines
1.9 KiB
Go
50 lines
1.9 KiB
Go
package constants
|
|
|
|
import "math"
|
|
|
|
const (
|
|
// MaxBlockVersion represents the current version of blocks mined and the maximum block version
|
|
// this node is able to validate
|
|
MaxBlockVersion uint16 = 0
|
|
|
|
// MaxTransactionVersion is the current latest supported transaction version.
|
|
MaxTransactionVersion uint16 = 0
|
|
|
|
// MaxScriptPublicKeyVersion is the current latest supported public key script version.
|
|
MaxScriptPublicKeyVersion uint16 = 0
|
|
|
|
// SompiPerKaspa is the number of sompi in one kaspa (1 KAS).
|
|
SompiPerKaspa = 100_000_000
|
|
|
|
// MaxSompi is the maximum transaction amount allowed in sompi.
|
|
MaxSompi = 21_000_000 * SompiPerKaspa
|
|
|
|
// MaxTxInSequenceNum is the maximum sequence number the sequence field
|
|
// of a transaction input can be.
|
|
MaxTxInSequenceNum uint64 = math.MaxUint64
|
|
|
|
// SequenceLockTimeDisabled is a flag that if set on a transaction
|
|
// input's sequence number, the sequence number will not be interpreted
|
|
// as a relative locktime.
|
|
SequenceLockTimeDisabled uint64 = 1 << 63
|
|
|
|
// SequenceLockTimeIsSeconds is a flag that if set on a transaction
|
|
// input's sequence number, the relative locktime has units of 1 second.
|
|
// If the flag is not set, the relative lockatime is according to DAA score.
|
|
SequenceLockTimeIsSeconds uint64 = 1 << 62
|
|
|
|
// SequenceLockTimeMask is a mask that extracts the relative locktime
|
|
// when masked against the transaction input sequence number.
|
|
SequenceLockTimeMask uint64 = 0x00000000ffffffff
|
|
|
|
// SequenceLockTimeGranularity is the defined time based granularity
|
|
// for milliseconds-based relative time locks. When converting from milliseconds
|
|
// to a sequence number, the value is multiplied by this amount,
|
|
// therefore the granularity of relative time locks is 1000 milliseconds or 1 second.
|
|
SequenceLockTimeGranularity = 1000
|
|
|
|
// LockTimeThreshold is the number below which a lock time is
|
|
// interpreted to be a block number.
|
|
LockTimeThreshold = 5e11 // Tue Nov 5 00:53:20 1985 UTC
|
|
)
|