aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/data/bitcoin-util-test.json116
-rw-r--r--src/test/data/txcreatemultisig1.hex1
-rw-r--r--src/test/data/txcreatemultisig1.json26
-rw-r--r--src/test/data/txcreatemultisig2.hex1
-rw-r--r--src/test/data/txcreatemultisig2.json24
-rw-r--r--src/test/data/txcreatemultisig3.hex1
-rw-r--r--src/test/data/txcreatemultisig3.json20
-rw-r--r--src/test/data/txcreatemultisig4.hex1
-rw-r--r--src/test/data/txcreatemultisig4.json24
-rw-r--r--src/test/data/txcreateoutpubkey1.hex1
-rw-r--r--src/test/data/txcreateoutpubkey1.json24
-rw-r--r--src/test/data/txcreateoutpubkey2.hex1
-rw-r--r--src/test/data/txcreateoutpubkey2.json20
-rw-r--r--src/test/data/txcreateoutpubkey3.hex1
-rw-r--r--src/test/data/txcreateoutpubkey3.json24
-rw-r--r--src/test/data/txcreatescript1.hex1
-rw-r--r--src/test/data/txcreatescript1.json20
-rw-r--r--src/test/data/txcreatescript2.hex1
-rw-r--r--src/test/data/txcreatescript2.json24
-rw-r--r--src/test/data/txcreatescript3.hex1
-rw-r--r--src/test/data/txcreatescript3.json20
-rw-r--r--src/test/data/txcreatescript4.hex1
-rw-r--r--src/test/data/txcreatescript4.json24
-rw-r--r--src/test/skiplist_tests.cpp43
-rw-r--r--src/test/transaction_tests.cpp6
25 files changed, 423 insertions, 3 deletions
diff --git a/src/test/data/bitcoin-util-test.json b/src/test/data/bitcoin-util-test.json
index d001b2056f..a80ab51901 100644
--- a/src/test/data/bitcoin-util-test.json
+++ b/src/test/data/bitcoin-util-test.json
@@ -118,6 +118,46 @@
"description": "Parses a transation with no inputs and a single output script (output in json)"
},
{ "exec": "./bitcoin-tx",
+ "args": ["-create", "outscript=0:OP_DROP", "nversion=1"],
+ "output_cmp": "txcreatescript1.hex",
+ "description": "Create a new transaction with a single output script (OP_DROP)"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-json", "-create", "outscript=0:OP_DROP", "nversion=1"],
+ "output_cmp": "txcreatescript1.json",
+ "description": "Create a new transaction with a single output script (OP_DROP) (output as json)"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-create", "outscript=0:OP_DROP:S", "nversion=1"],
+ "output_cmp": "txcreatescript2.hex",
+ "description": "Create a new transaction with a single output script (OP_DROP) in a P2SH"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-json", "-create", "outscript=0:OP_DROP:S", "nversion=1"],
+ "output_cmp": "txcreatescript2.json",
+ "description": "Create a new transaction with a single output script (OP_DROP) in a P2SH (output as json)"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-create", "outscript=0:OP_DROP:W", "nversion=1"],
+ "output_cmp": "txcreatescript3.hex",
+ "description": "Create a new transaction with a single output script (OP_DROP) in a P2WSH"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-json", "-create", "outscript=0:OP_DROP:W", "nversion=1"],
+ "output_cmp": "txcreatescript3.json",
+ "description": "Create a new transaction with a single output script (OP_DROP) in a P2WSH (output as json)"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-create", "outscript=0:OP_DROP:WS", "nversion=1"],
+ "output_cmp": "txcreatescript4.hex",
+ "description": "Create a new transaction with a single output script (OP_DROP) in a P2WSH, wrapped in a P2SH"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-json", "-create", "outscript=0:OP_DROP:WS", "nversion=1"],
+ "output_cmp": "txcreatescript4.json",
+ "description": "Create a new transaction with a single output script (OP_DROP) in a P2SH, wrapped in a P2SH (output as json)"
+ },
+ { "exec": "./bitcoin-tx",
"args":
["-create", "nversion=1",
"in=4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485:0",
@@ -153,6 +193,42 @@
},
{ "exec": "./bitcoin-tx",
"args":
+ ["-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397", "nversion=1"],
+ "output_cmp": "txcreateoutpubkey1.hex",
+ "description": "Creates a new transaction with a single pay-to-pubkey output"
+ },
+ { "exec": "./bitcoin-tx",
+ "args":
+ ["-json", "-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397", "nversion=1"],
+ "output_cmp": "txcreateoutpubkey1.json",
+ "description": "Creates a new transaction with a single pay-to-pubkey output (output as json)"
+ },
+ { "exec": "./bitcoin-tx",
+ "args":
+ ["-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:W", "nversion=1"],
+ "output_cmp": "txcreateoutpubkey2.hex",
+ "description": "Creates a new transaction with a single pay-to-witness-pubkey output"
+ },
+ { "exec": "./bitcoin-tx",
+ "args":
+ ["-json", "-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:W", "nversion=1"],
+ "output_cmp": "txcreateoutpubkey2.json",
+ "description": "Creates a new transaction with a single pay-to-witness-pubkey output (output as json)"
+ },
+ { "exec": "./bitcoin-tx",
+ "args":
+ ["-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:WS", "nversion=1"],
+ "output_cmp": "txcreateoutpubkey3.hex",
+ "description": "Creates a new transaction with a single pay-to-witness-pubkey, wrapped in P2SH output"
+ },
+ { "exec": "./bitcoin-tx",
+ "args":
+ ["-json", "-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:WS", "nversion=1"],
+ "output_cmp": "txcreateoutpubkey3.json",
+ "description": "Creates a new transaction with a single pay-to-pub-key output, wrapped in P2SH (output as json)"
+ },
+ { "exec": "./bitcoin-tx",
+ "args":
["-create",
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
"outdata=4:badhexdata"],
@@ -236,5 +312,45 @@
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:1"],
"output_cmp": "txcreatedata_seq1.json",
"description": "Adds a new input with sequence number to a transaction (output in json)"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485", "nversion=1"],
+ "output_cmp": "txcreatemultisig1.hex",
+ "description": "Creates a new transaction with a single 2-of-3 multisig output"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485", "nversion=1"],
+ "output_cmp": "txcreatemultisig1.json",
+ "description": "Creates a new transaction with a single 2-of-3 multisig output (output in json)"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:S", "nversion=1"],
+ "output_cmp": "txcreatemultisig2.hex",
+ "description": "Creates a new transaction with a single 2-of-3 multisig in a P2SH output"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:S", "nversion=1"],
+ "output_cmp": "txcreatemultisig2.json",
+ "description": "Creates a new transaction with a single 2-of-3 multisig in a P2SH output (output in json)"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:W", "nversion=1"],
+ "output_cmp": "txcreatemultisig3.hex",
+ "description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:W", "nversion=1"],
+ "output_cmp": "txcreatemultisig3.json",
+ "description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output (output in json)"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:WS", "nversion=1"],
+ "output_cmp": "txcreatemultisig4.hex",
+ "description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output, wrapped in P2SH"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:WS", "nversion=1"],
+ "output_cmp": "txcreatemultisig4.json",
+ "description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output, wrapped in P2SH (output in json)"
}
]
diff --git a/src/test/data/txcreatemultisig1.hex b/src/test/data/txcreatemultisig1.hex
new file mode 100644
index 0000000000..9c00004d38
--- /dev/null
+++ b/src/test/data/txcreatemultisig1.hex
@@ -0,0 +1 @@
+01000000000100e1f5050000000069522102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff39721021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d2102df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb48553ae00000000
diff --git a/src/test/data/txcreatemultisig1.json b/src/test/data/txcreatemultisig1.json
new file mode 100644
index 0000000000..f6ce43c202
--- /dev/null
+++ b/src/test/data/txcreatemultisig1.json
@@ -0,0 +1,26 @@
+{
+ "txid": "0d1d4edfc217d9db3ab6a9298f26a52eae3c52f55a6cb8ccbc14f7c727572894",
+ "hash": "0d1d4edfc217d9db3ab6a9298f26a52eae3c52f55a6cb8ccbc14f7c727572894",
+ "version": 1,
+ "locktime": 0,
+ "vin": [
+ ],
+ "vout": [
+ {
+ "value": 1.00,
+ "n": 0,
+ "scriptPubKey": {
+ "asm": "2 02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397 021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d 02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485 3 OP_CHECKMULTISIG",
+ "hex": "522102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff39721021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d2102df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb48553ae",
+ "reqSigs": 2,
+ "type": "multisig",
+ "addresses": [
+ "1FoG2386FG2tAJS9acMuiDsKy67aGg9MKz",
+ "1FXtz9KU8JNmQDyHdiEm5HDiALuP3zdHvV",
+ "14LuavcBbXZYJ6Tsz3cAUQj9SuQoL2xCQX"
+ ]
+ }
+ }
+ ],
+ "hex": "01000000000100e1f5050000000069522102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff39721021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d2102df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb48553ae00000000"
+}
diff --git a/src/test/data/txcreatemultisig2.hex b/src/test/data/txcreatemultisig2.hex
new file mode 100644
index 0000000000..07835c54d3
--- /dev/null
+++ b/src/test/data/txcreatemultisig2.hex
@@ -0,0 +1 @@
+01000000000100e1f5050000000017a9141c6fbaf46d64221e80cbae182c33ddf81b9294ac8700000000
diff --git a/src/test/data/txcreatemultisig2.json b/src/test/data/txcreatemultisig2.json
new file mode 100644
index 0000000000..e09d22060f
--- /dev/null
+++ b/src/test/data/txcreatemultisig2.json
@@ -0,0 +1,24 @@
+{
+ "txid": "0d861f278a3b7bce7cb5a88d71e6e6a903336f95ad5a2c29b295b63835b6eee3",
+ "hash": "0d861f278a3b7bce7cb5a88d71e6e6a903336f95ad5a2c29b295b63835b6eee3",
+ "version": 1,
+ "locktime": 0,
+ "vin": [
+ ],
+ "vout": [
+ {
+ "value": 1.00,
+ "n": 0,
+ "scriptPubKey": {
+ "asm": "OP_HASH160 1c6fbaf46d64221e80cbae182c33ddf81b9294ac OP_EQUAL",
+ "hex": "a9141c6fbaf46d64221e80cbae182c33ddf81b9294ac87",
+ "reqSigs": 1,
+ "type": "scripthash",
+ "addresses": [
+ "34HNh57oBCRKkxNyjTuWAJkTbuGh6jg2Ms"
+ ]
+ }
+ }
+ ],
+ "hex": "01000000000100e1f5050000000017a9141c6fbaf46d64221e80cbae182c33ddf81b9294ac8700000000"
+}
diff --git a/src/test/data/txcreatemultisig3.hex b/src/test/data/txcreatemultisig3.hex
new file mode 100644
index 0000000000..8d34f28f87
--- /dev/null
+++ b/src/test/data/txcreatemultisig3.hex
@@ -0,0 +1 @@
+01000000000100e1f50500000000220020e15a86a23178f433d514dbbce042e87d72662b8b5edcacfd2e37ab7a2d135f0500000000
diff --git a/src/test/data/txcreatemultisig3.json b/src/test/data/txcreatemultisig3.json
new file mode 100644
index 0000000000..88e32bd310
--- /dev/null
+++ b/src/test/data/txcreatemultisig3.json
@@ -0,0 +1,20 @@
+{
+ "txid": "ccc552220b46a3b5140048b03395987ce4f0fa1ddf8c635bba1fa44e0f8c1d7f",
+ "hash": "ccc552220b46a3b5140048b03395987ce4f0fa1ddf8c635bba1fa44e0f8c1d7f",
+ "version": 1,
+ "locktime": 0,
+ "vin": [
+ ],
+ "vout": [
+ {
+ "value": 1.00,
+ "n": 0,
+ "scriptPubKey": {
+ "asm": "0 e15a86a23178f433d514dbbce042e87d72662b8b5edcacfd2e37ab7a2d135f05",
+ "hex": "0020e15a86a23178f433d514dbbce042e87d72662b8b5edcacfd2e37ab7a2d135f05",
+ "type": "witness_v0_scripthash"
+ }
+ }
+ ],
+ "hex": "01000000000100e1f50500000000220020e15a86a23178f433d514dbbce042e87d72662b8b5edcacfd2e37ab7a2d135f0500000000"
+}
diff --git a/src/test/data/txcreatemultisig4.hex b/src/test/data/txcreatemultisig4.hex
new file mode 100644
index 0000000000..7da54366c7
--- /dev/null
+++ b/src/test/data/txcreatemultisig4.hex
@@ -0,0 +1 @@
+01000000000100e1f5050000000017a9146edf12858999f0dae74f9c692e6694ee3621b2ac8700000000
diff --git a/src/test/data/txcreatemultisig4.json b/src/test/data/txcreatemultisig4.json
new file mode 100644
index 0000000000..fc69c7269c
--- /dev/null
+++ b/src/test/data/txcreatemultisig4.json
@@ -0,0 +1,24 @@
+{
+ "txid": "5e8b1cc73234e208d4b7ca9075f136b908c34101be7a048df4ba9ac758b61567",
+ "hash": "5e8b1cc73234e208d4b7ca9075f136b908c34101be7a048df4ba9ac758b61567",
+ "version": 1,
+ "locktime": 0,
+ "vin": [
+ ],
+ "vout": [
+ {
+ "value": 1.00,
+ "n": 0,
+ "scriptPubKey": {
+ "asm": "OP_HASH160 6edf12858999f0dae74f9c692e6694ee3621b2ac OP_EQUAL",
+ "hex": "a9146edf12858999f0dae74f9c692e6694ee3621b2ac87",
+ "reqSigs": 1,
+ "type": "scripthash",
+ "addresses": [
+ "3BoFUz1StqcNcgUTZE5cC1eFhuYFzj3fGH"
+ ]
+ }
+ }
+ ],
+ "hex": "01000000000100e1f5050000000017a9146edf12858999f0dae74f9c692e6694ee3621b2ac8700000000"
+}
diff --git a/src/test/data/txcreateoutpubkey1.hex b/src/test/data/txcreateoutpubkey1.hex
new file mode 100644
index 0000000000..4a08244b2f
--- /dev/null
+++ b/src/test/data/txcreateoutpubkey1.hex
@@ -0,0 +1 @@
+0100000000010000000000000000232102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397ac00000000
diff --git a/src/test/data/txcreateoutpubkey1.json b/src/test/data/txcreateoutpubkey1.json
new file mode 100644
index 0000000000..6019fa2dcd
--- /dev/null
+++ b/src/test/data/txcreateoutpubkey1.json
@@ -0,0 +1,24 @@
+{
+ "txid": "f42b38ac12e3fafc96ba1a9ba70cbfe326744aef75df5fb9db5d6e2855ca415f",
+ "hash": "f42b38ac12e3fafc96ba1a9ba70cbfe326744aef75df5fb9db5d6e2855ca415f",
+ "version": 1,
+ "locktime": 0,
+ "vin": [
+ ],
+ "vout": [
+ {
+ "value": 0.00,
+ "n": 0,
+ "scriptPubKey": {
+ "asm": "02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397 OP_CHECKSIG",
+ "hex": "2102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397ac",
+ "reqSigs": 1,
+ "type": "pubkey",
+ "addresses": [
+ "1FoG2386FG2tAJS9acMuiDsKy67aGg9MKz"
+ ]
+ }
+ }
+ ],
+ "hex": "0100000000010000000000000000232102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397ac00000000"
+}
diff --git a/src/test/data/txcreateoutpubkey2.hex b/src/test/data/txcreateoutpubkey2.hex
new file mode 100644
index 0000000000..8283c722ab
--- /dev/null
+++ b/src/test/data/txcreateoutpubkey2.hex
@@ -0,0 +1 @@
+0100000000010000000000000000160014a2516e770582864a6a56ed21a102044e388c62e300000000
diff --git a/src/test/data/txcreateoutpubkey2.json b/src/test/data/txcreateoutpubkey2.json
new file mode 100644
index 0000000000..6fc3d57527
--- /dev/null
+++ b/src/test/data/txcreateoutpubkey2.json
@@ -0,0 +1,20 @@
+{
+ "txid": "70f2a088cde460e677415fa1fb71895e90c231e6ed38ed203a35b6f848e9cc73",
+ "hash": "70f2a088cde460e677415fa1fb71895e90c231e6ed38ed203a35b6f848e9cc73",
+ "version": 1,
+ "locktime": 0,
+ "vin": [
+ ],
+ "vout": [
+ {
+ "value": 0.00,
+ "n": 0,
+ "scriptPubKey": {
+ "asm": "0 a2516e770582864a6a56ed21a102044e388c62e3",
+ "hex": "0014a2516e770582864a6a56ed21a102044e388c62e3",
+ "type": "witness_v0_keyhash"
+ }
+ }
+ ],
+ "hex": "0100000000010000000000000000160014a2516e770582864a6a56ed21a102044e388c62e300000000"
+}
diff --git a/src/test/data/txcreateoutpubkey3.hex b/src/test/data/txcreateoutpubkey3.hex
new file mode 100644
index 0000000000..84adff4d89
--- /dev/null
+++ b/src/test/data/txcreateoutpubkey3.hex
@@ -0,0 +1 @@
+010000000001000000000000000017a914a5ab14c9804d0d8bf02f1aea4e82780733ad0a838700000000
diff --git a/src/test/data/txcreateoutpubkey3.json b/src/test/data/txcreateoutpubkey3.json
new file mode 100644
index 0000000000..a1a25fc834
--- /dev/null
+++ b/src/test/data/txcreateoutpubkey3.json
@@ -0,0 +1,24 @@
+{
+ "txid": "bfc7e898ee9f6a9652d7b8cca147e2da134502e2ada0f279ed634fc8cf833f8c",
+ "hash": "bfc7e898ee9f6a9652d7b8cca147e2da134502e2ada0f279ed634fc8cf833f8c",
+ "version": 1,
+ "locktime": 0,
+ "vin": [
+ ],
+ "vout": [
+ {
+ "value": 0.00,
+ "n": 0,
+ "scriptPubKey": {
+ "asm": "OP_HASH160 a5ab14c9804d0d8bf02f1aea4e82780733ad0a83 OP_EQUAL",
+ "hex": "a914a5ab14c9804d0d8bf02f1aea4e82780733ad0a8387",
+ "reqSigs": 1,
+ "type": "scripthash",
+ "addresses": [
+ "3GnzN8FqgvYGYdhj8NW6UNxxVv3Uj1ApQn"
+ ]
+ }
+ }
+ ],
+ "hex": "010000000001000000000000000017a914a5ab14c9804d0d8bf02f1aea4e82780733ad0a838700000000"
+}
diff --git a/src/test/data/txcreatescript1.hex b/src/test/data/txcreatescript1.hex
new file mode 100644
index 0000000000..0adce270fb
--- /dev/null
+++ b/src/test/data/txcreatescript1.hex
@@ -0,0 +1 @@
+0100000000010000000000000000017500000000
diff --git a/src/test/data/txcreatescript1.json b/src/test/data/txcreatescript1.json
new file mode 100644
index 0000000000..8ffecba411
--- /dev/null
+++ b/src/test/data/txcreatescript1.json
@@ -0,0 +1,20 @@
+{
+ "txid": "f0851b68202f736b792649cfc960259c2374badcb644ab20cac726b5f72f61c9",
+ "hash": "f0851b68202f736b792649cfc960259c2374badcb644ab20cac726b5f72f61c9",
+ "version": 1,
+ "locktime": 0,
+ "vin": [
+ ],
+ "vout": [
+ {
+ "value": 0.00,
+ "n": 0,
+ "scriptPubKey": {
+ "asm": "OP_DROP",
+ "hex": "75",
+ "type": "nonstandard"
+ }
+ }
+ ],
+ "hex": "0100000000010000000000000000017500000000"
+}
diff --git a/src/test/data/txcreatescript2.hex b/src/test/data/txcreatescript2.hex
new file mode 100644
index 0000000000..5afe8786e3
--- /dev/null
+++ b/src/test/data/txcreatescript2.hex
@@ -0,0 +1 @@
+010000000001000000000000000017a91471ed53322d470bb96657deb786b94f97dd46fb158700000000
diff --git a/src/test/data/txcreatescript2.json b/src/test/data/txcreatescript2.json
new file mode 100644
index 0000000000..41eb69f1af
--- /dev/null
+++ b/src/test/data/txcreatescript2.json
@@ -0,0 +1,24 @@
+{
+ "txid": "6e07a7cc075e0703f32ee8c4e5373fe654bfbc315148fda364e1be286ff290d0",
+ "hash": "6e07a7cc075e0703f32ee8c4e5373fe654bfbc315148fda364e1be286ff290d0",
+ "version": 1,
+ "locktime": 0,
+ "vin": [
+ ],
+ "vout": [
+ {
+ "value": 0.00,
+ "n": 0,
+ "scriptPubKey": {
+ "asm": "OP_HASH160 71ed53322d470bb96657deb786b94f97dd46fb15 OP_EQUAL",
+ "hex": "a91471ed53322d470bb96657deb786b94f97dd46fb1587",
+ "reqSigs": 1,
+ "type": "scripthash",
+ "addresses": [
+ "3C5QarEGh9feKbDJ3QbMf2YNjnMoiPDhNp"
+ ]
+ }
+ }
+ ],
+ "hex": "010000000001000000000000000017a91471ed53322d470bb96657deb786b94f97dd46fb158700000000"
+}
diff --git a/src/test/data/txcreatescript3.hex b/src/test/data/txcreatescript3.hex
new file mode 100644
index 0000000000..8a2b973bf0
--- /dev/null
+++ b/src/test/data/txcreatescript3.hex
@@ -0,0 +1 @@
+01000000000100000000000000002200200bfe935e70c321c7ca3afc75ce0d0ca2f98b5422e008bb31c00c6d7f1f1c0ad600000000
diff --git a/src/test/data/txcreatescript3.json b/src/test/data/txcreatescript3.json
new file mode 100644
index 0000000000..90e7e27f9f
--- /dev/null
+++ b/src/test/data/txcreatescript3.json
@@ -0,0 +1,20 @@
+{
+ "txid": "8a234037b088e987c877030efc83374a07441c321bf9dc6dd2f206bc26507df8",
+ "hash": "8a234037b088e987c877030efc83374a07441c321bf9dc6dd2f206bc26507df8",
+ "version": 1,
+ "locktime": 0,
+ "vin": [
+ ],
+ "vout": [
+ {
+ "value": 0.00,
+ "n": 0,
+ "scriptPubKey": {
+ "asm": "0 0bfe935e70c321c7ca3afc75ce0d0ca2f98b5422e008bb31c00c6d7f1f1c0ad6",
+ "hex": "00200bfe935e70c321c7ca3afc75ce0d0ca2f98b5422e008bb31c00c6d7f1f1c0ad6",
+ "type": "witness_v0_scripthash"
+ }
+ }
+ ],
+ "hex": "01000000000100000000000000002200200bfe935e70c321c7ca3afc75ce0d0ca2f98b5422e008bb31c00c6d7f1f1c0ad600000000"
+}
diff --git a/src/test/data/txcreatescript4.hex b/src/test/data/txcreatescript4.hex
new file mode 100644
index 0000000000..b4cfe58f42
--- /dev/null
+++ b/src/test/data/txcreatescript4.hex
@@ -0,0 +1 @@
+010000000001000000000000000017a9146a2c482f4985f57e702f325816c90e3723ca81ae8700000000
diff --git a/src/test/data/txcreatescript4.json b/src/test/data/txcreatescript4.json
new file mode 100644
index 0000000000..11783751a4
--- /dev/null
+++ b/src/test/data/txcreatescript4.json
@@ -0,0 +1,24 @@
+{
+ "txid": "24225cf5e9391100d6b218134b9f03383ca4c880a1f634ac12990cf28b66adbc",
+ "hash": "24225cf5e9391100d6b218134b9f03383ca4c880a1f634ac12990cf28b66adbc",
+ "version": 1,
+ "locktime": 0,
+ "vin": [
+ ],
+ "vout": [
+ {
+ "value": 0.00,
+ "n": 0,
+ "scriptPubKey": {
+ "asm": "OP_HASH160 6a2c482f4985f57e702f325816c90e3723ca81ae OP_EQUAL",
+ "hex": "a9146a2c482f4985f57e702f325816c90e3723ca81ae87",
+ "reqSigs": 1,
+ "type": "scripthash",
+ "addresses": [
+ "3BNQbeFeJJGMAyDxPwWPuqxPMrjsFLjk3f"
+ ]
+ }
+ }
+ ],
+ "hex": "010000000001000000000000000017a9146a2c482f4985f57e702f325816c90e3723ca81ae8700000000"
+}
diff --git a/src/test/skiplist_tests.cpp b/src/test/skiplist_tests.cpp
index 5b4ef3fe7d..0b2fe0ef9d 100644
--- a/src/test/skiplist_tests.cpp
+++ b/src/test/skiplist_tests.cpp
@@ -100,4 +100,47 @@ BOOST_AUTO_TEST_CASE(getlocator_test)
}
}
+BOOST_AUTO_TEST_CASE(findearliestatleast_test)
+{
+ std::vector<uint256> vHashMain(100000);
+ std::vector<CBlockIndex> vBlocksMain(100000);
+ for (unsigned int i=0; i<vBlocksMain.size(); i++) {
+ vHashMain[i] = ArithToUint256(i); // Set the hash equal to the height
+ vBlocksMain[i].nHeight = i;
+ vBlocksMain[i].pprev = i ? &vBlocksMain[i - 1] : NULL;
+ vBlocksMain[i].phashBlock = &vHashMain[i];
+ vBlocksMain[i].BuildSkip();
+ if (i < 10) {
+ vBlocksMain[i].nTime = i;
+ vBlocksMain[i].nTimeMax = i;
+ } else {
+ // randomly choose something in the range [MTP, MTP*2]
+ int64_t medianTimePast = vBlocksMain[i].GetMedianTimePast();
+ int r = insecure_rand() % medianTimePast;
+ vBlocksMain[i].nTime = r + medianTimePast;
+ vBlocksMain[i].nTimeMax = std::max(vBlocksMain[i].nTime, vBlocksMain[i-1].nTimeMax);
+ }
+ }
+ // Check that we set nTimeMax up correctly.
+ unsigned int curTimeMax = 0;
+ for (unsigned int i=0; i<vBlocksMain.size(); ++i) {
+ curTimeMax = std::max(curTimeMax, vBlocksMain[i].nTime);
+ BOOST_CHECK(curTimeMax == vBlocksMain[i].nTimeMax);
+ }
+
+ // Build a CChain for the main branch.
+ CChain chain;
+ chain.SetTip(&vBlocksMain.back());
+
+ // Verify that FindEarliestAtLeast is correct.
+ for (unsigned int i=0; i<10000; ++i) {
+ // Pick a random element in vBlocksMain.
+ int r = insecure_rand() % vBlocksMain.size();
+ int64_t test_time = vBlocksMain[r].nTime;
+ CBlockIndex *ret = chain.FindEarliestAtLeast(test_time);
+ BOOST_CHECK(ret->nTimeMax >= test_time);
+ BOOST_CHECK((ret->pprev==NULL) || ret->pprev->nTimeMax < test_time);
+ BOOST_CHECK(vBlocksMain[r].GetAncestor(ret->nHeight) == ret);
+ }
+}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp
index 8c9aaef02f..374423179c 100644
--- a/src/test/transaction_tests.cpp
+++ b/src/test/transaction_tests.cpp
@@ -690,7 +690,7 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
BOOST_CHECK(IsStandardTx(t, reason));
// Check dust with default relay fee:
- CAmount nDustThreshold = 182 * minRelayTxFee.GetFeePerK()/1000 * 3;
+ CAmount nDustThreshold = 182 * dustRelayFee.GetFeePerK()/1000 * 3;
BOOST_CHECK_EQUAL(nDustThreshold, 546);
// dust:
t.vout[0].nValue = nDustThreshold - 1;
@@ -701,14 +701,14 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
// Check dust with odd relay fee to verify rounding:
// nDustThreshold = 182 * 1234 / 1000 * 3
- minRelayTxFee = CFeeRate(1234);
+ dustRelayFee = CFeeRate(1234);
// dust:
t.vout[0].nValue = 672 - 1;
BOOST_CHECK(!IsStandardTx(t, reason));
// not dust:
t.vout[0].nValue = 672;
BOOST_CHECK(IsStandardTx(t, reason));
- minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
+ dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE);
t.vout[0].scriptPubKey = CScript() << OP_1;
BOOST_CHECK(!IsStandardTx(t, reason));