* [NOD-532] Change chain to DAG in the root package.
* [NOD-532] Change chain to DAG in checkpoints.go.
* [NOD-532] Change chain to DAG in blockdag.
* [NOD-532] Change chain to DAG in cmd.
* [NOD-532] Change chain to DAG in dagconfig.
* [NOD-532] Change chain to DAG in database.
* [NOD-532] Change chain to DAG in mempool.
* [NOD-532] Change chain to DAG in mempool.
* [NOD-532] Change chain to DAG in netsync.
* [NOD-532] Change chain to DAG in rpcclient.
* [NOD-532] Change chain to DAG in server.
* [NOD-532] Change chain to DAG in txscript.
* [NOD-532] Change chain to DAG in util.
* [NOD-532] Change chain to DAG in wire.
* [NOD-532] Remove block heights in dagio.go examples.
* [NOD-532] Rename fakeChain to fakeDAG.
* [NOD-532] Fix comments, remove unused EnableBCInfoHacks flag.
* [NOD-532] Fix comments and variable names.
* [NOD-532] Fix comments.
* [NOD-532] Fix merge errors.
* [NOD-532] Formatted project.
* [NOD-172] Port EMCH from bchd
* [NOD-172] Fix hdkeychain.TestErrors and add btcec.TestRecoverCompact
* [NOD-172] Make ECMH immutable
* [NOD-172] Fix gofmt errors
* [NOD-172] Add TestMultiset_NewMultisetFromDataSlice and fix Point to be immutable
* [NOD-172] Fix gofmt errors
* [NOD-172] Add test for checking that the Union of a multiset and its inverse is zero
* [NOD-179] Add ECMH Point to all UTXO-structs
* [NOD-179] Fix utxo set tests
* [NOD-179] Fix mempool tests
* [NOD-179] Remove RemoveTxOuts
* [NOD-179] Move serializeBlockUTXODiffData to the top of the file
* [NOD-179] Fix serializeBlockUTXODiffData comment format
* [NOD-179] Fix AddTx comment and name return values
* [DEV-91] add tests for RemoveOrphansByTag
* [DEV-91] Add tests for orphan tx expiration
* [DEV-91] add TestDoubleSpends
* [DEV-91] add TestFetchTransaction
* [DEV-91] added a test for MinHighPriority
* [DEV-91] test unparsable scripts
* [DEV-91] test MaxOrphanTxs=0
* [DEV-91] add TestRemoveTransaction
* [DEV-105] use utxodiff in mempool instead of utxoview
* [DEV-105] get rid of utxoview
* [DEV-105] fix tests to use utxoset
* [DEV-105] remove utxoview type
* [DEV-105] move DagSetup to test_utils.go
* [DEV-105] add comments and add blockdag/test_utils_test.go
* [DEV-105] change checkPoolDoubleSpend to check utxodiff
* [DEV-105] add restoreInputs arg to removeTransaction
* [DEV-91] add restoreInputs arg to removeTransaction in unit tests
* [DEV-105] add restoreInputs arg to removeTransaction
* [DEV-105] give more descriptive names to vars
* [DEV-115] close txChan outside of HandleNewBlock
* [DEV-105] rename DagSetup -> DAGSetup
* [DEV-91] remove IsSpentInDiff
* [DEV-91] fix comment
* [DEV-91] Make IsPushOnlyScript return an error if the script cannot be parsed
* [DEV-91] add more tests for IsPushOnlyScript
* [DEV-91] fix comments
* [DEV-98] Move script flags from relay rules to consensus
* [DEV-98] remove flags from script_tests.json
* [DEV-98] fix multisig and remove test that assume no minimal data rule
* [DEV-98] rename bip16 bool to isP2sh
* [DEV-98] add sighash type to overly long signature in script_tests.json
* [DEV-98] add test for NUMEQUAL for non equal numbers script_tests.json
* [DEV-98] remove debugging if
* [DEV-98] remove ErrCleanStack from EVAL_FALSE
* [DEV-98] change isP2sh to isP2SH to comply with Go style
* [DEV-98] add ScriptNoFlags to explictly indicate for empty ScriptFlags
* [DEV-98] rename ErrPubKeyType -> ErrPubKeyFormat
* [DEV-98] rename PUBKEYTYPE -> PUBKEYFORMAT
* [DEV-97] Moved github.com/daglabs/btcutil into github.com/daglabs/btcd/btcutil.
* [DEV-97] Updated Gopkg.toml to no longer refer to btcutil.
* [DEV-97] Renamed btcutil to util.
* [DEV-18] changed CSV/CLTV to be regular op codes, and returned nop2 and nop3 to be regular nops
* [DEV-18] remove csv/cltv flags - part 1
* [DEV-18] remove csv/cltv flags - part 2
* [DEV-18] remove csv/cltv activation rules
* [DEV-18] remove csv/cltv activation rules
* [DEV-18] csv_fork_test fixes
* [DEV-18] readd chain params
* [DEV-18] readd chain params and remove csv activation rules
* [DEV-18] returned build flags to integration test
* [DEV-18] make csv/cltv to pop the the first element of the stack instead of peeking it
* [DEV-18] fix comments related to CSV/CLTV to remove any reference to soft fork
* [DEV-18] fix comments related to CSV/CLTV to remove any reference to soft fork
* [DEV-18] rename csv_fork_test.go to csv_fork.go
* [DEV-18] change mTx location
* [DEV-18] remove BIP0065Height
* [DEV-18] add function isUpgradableNop for readability
* [DEV-50] Remove the Multisig bug requiring a dummy push
* [DEV-50] Removed redundant comment, since dummy bug was fixed
* [DEV-50] Removed some more dummy-related comments and error message
This commit implements the flag activation portion of BIP 0147. The
verification behavior triggered by the NULLDUMMY script verification
flag has been present within btcd for some time, however it wasn’t
activated by default.
With this commit, once segwit has activated, the ScriptStrictMultiSig
will also be activated within the Script VM. Additionally, the
ScriptStrictMultiSig is now a standard script verification flag which
is used unconditionally within the mempool.
This commit implements full witness program validation for the
currently defined version 0 witness programs. This includes validation
logic for nested p2sh, p2wsh, and p2wkh. Additionally, when in witness
validation mode, an additional set of constrains are enforced such as
using the new sighash digest algorithm and enforcing clean stack
behavior within witness programs.
This commit introduces a series of internal and external helper
functions which enable the txscript package to be aware of the new
standard script templates introduced as part of BIP0141. The two new
standard script templates recognized are pay-to-witness-key-hash
(P2WKH) and pay-to-witness-script-hash (P2WSH).
ScriptVerifyNullFail defines that signatures must be empty if a
CHECKSIG or CHECKMULTISIG operation fails.
This commit also enables ScriptVerifyNullFail at the mempool policy
level.
This converts the majority of script errors from generic errors created
via errors.New and fmt.Errorf to use a concrete type that implements the
error interface with an error code and description.
This allows callers to programmatically detect the type of error via
type assertions and an error code while still allowing the errors to
provide more context.
For example, instead of just having an error the reads "disabled opcode"
as would happen prior to these changes when a disabled opcode is
encountered, the error will now read "attempt to execute disabled opcode
OP_FOO".
While it was previously possible to programmatically detect many errors
due to them being exported, they provided no additional context and
there were also various instances that were just returning errors
created on the spot which callers could not reliably detect without
resorting to looking at the actual error message, which is nearly always
bad practice.
Also, while here, export the MaxStackSize and MaxScriptSize constants
since they can be useful for consumers of the package and perform some
minor cleanup of some of the tests.
This modifies the recently-added NullDataScript function in several
ways in an effort to make them more consistent with the tests in the
rest of the code base and improve/correct the logic:
- Use the hexToBytes and mustParseShortForm functions
- Consistently format the test errors
- Replace the valid bool flag with an expected error and test against it
- Ensure the returned script type is the expected type in all cases
This adds a new function named NullDataScript to the txscript package that returns a provably-pruneable OP_RETURN script with the provided data. The function will return an error if the provided data is larger than the maximum allowed length for a nulldata script to be be considered standard.
This corrects the isNullData standard transaction type test to work
properly with canonically-encoded data pushes. In particular, single
byte data pushes that are small integers (0-16) are converted to the
equivalent numeric opcodes when canonically encoded and the code failed
to detect them properly.
It also adds several tests to ensure that both canonical and
non-canonical nulldata scripts are recognized properly and modifies the
test failure print to include the script that failed.
This does not affect consensus since it is just a standardness check.
isMultiSig was not verifying the number of pubkeys specified matched
the number of pubkeys provided. This caused certain non-standard
scripts to be considered multisig scripts.
However, the script still would have failed during execution.
NOTE: This only affects whether or not the script is considered
standard and does NOT affect consensus.
Also, add a test for this check.
See https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki for
more information.
This commit mimics Bitcoin Core commit bc60b2b4b401f0adff5b8b9678903ff8feb5867b
and includes additional tests from Bitcoin Core commit
cb54d17355864fa08826d6511a0d7692b21ef2c9
We've already been generating lowS sigs for quite a while. This removes
the malleability vector.
This mimics Bitcoin Core commit 49dd5c629df0a08cf3b1ea8085c03312d1a81696
- Move reference tests to test package since they are intended to
exercise the engine as callers would
- Improve the short form script parsing to allow additional opcodes:
DATA_#, OP_#, FALSE, TRUE
- Make use of a function to decode hex strings rather than manually
defining byte slices
- Update the tests to make use of the short form script parsing logic
rather than manually defining byte slices
- Consistently replace all []byte{} and [][]byte{} with nil
- Define tests only used in a specific function inside that func
- Move invalid flag combination test to engine_test since that is what
it is testing
- Remove all redundant script tests in favor of the JSON-based tests in
the data directory.
- Move several functions from internal_test.go to the test files
associated with what the tests are checking
This commit moves all code related to standard scripts into a separate
file named standard.go as well as the associated tests into
standard_test.go. Since the code in address.go and address_test.go is
only related to standard scripts, it has been combined into the new
files and the old files deleted.
The intent here is to make it clear that the code in standard.go is not
related to consensus.