PIVX Core  5.6.99
P2P Digital Currency
script_P2SH_tests.cpp
Go to the documentation of this file.
1 // Copyright (c) 2012-2013 The Bitcoin Core developers
2 // Copyright (c) 2019-2021 The PIVX Core developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #include "test/test_pivx.h"
7 
8 #include "consensus/tx_verify.h"
9 #include "key.h"
10 #include "keystore.h"
11 #include "policy/policy.h"
12 #include "script/script.h"
13 #include "script/script_error.h"
14 #include "script/sign.h"
15 #include "script/ismine.h"
16 #include "validation.h"
17 
18 #include <vector>
19 
20 #include <boost/test/unit_test.hpp>
21 
22 
23 // Helpers:
24 static std::vector<unsigned char>
25 Serialize(const CScript& s)
26 {
27  std::vector<unsigned char> sSerialized(s.begin(), s.end());
28  return sSerialized;
29 }
30 
31 static bool
32 Verify(const CScript& scriptSig, const CScript& scriptPubKey, bool fStrict, ScriptError& err)
33 {
34  // Create dummy to/from transactions:
35  CMutableTransaction txFrom;
36  txFrom.vout.resize(1);
37  txFrom.vout[0].scriptPubKey = scriptPubKey;
38 
40  txTo.vin.resize(1);
41  txTo.vout.resize(1);
42  txTo.vin[0].prevout.n = 0;
43  txTo.vin[0].prevout.hash = txFrom.GetHash();
44  txTo.vin[0].scriptSig = scriptSig;
45  txTo.vout[0].nValue = 1;
46 
47  return VerifyScript(scriptSig, scriptPubKey, fStrict ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE,
48  MutableTransactionSignatureChecker(&txTo, 0, txFrom.vout[0].nValue), txTo.GetRequiredSigVersion(), &err);
49 }
50 
51 BOOST_FIXTURE_TEST_SUITE(script_P2SH_tests, TestingSetup)
52 
54 {
55  LOCK(cs_main);
56  // Pay-to-script-hash looks like this:
57  // scriptSig: <sig> <sig...> <serialized_script>
58  // scriptPubKey: HASH160 <hash> EQUAL
59 
60  // Test SignSignature() (and therefore the version of Solver() that signs transactions)
61  CBasicKeyStore keystore;
62  CKey key[4];
63  for (int i = 0; i < 4; i++)
64  {
65  key[i].MakeNewKey(true);
66  keystore.AddKey(key[i]);
67  }
68 
69  // 8 Scripts: checking all combinations of
70  // different keys, straight/P2SH, pubkey/pubkeyhash
71  CScript standardScripts[4];
72  standardScripts[0] << ToByteVector(key[0].GetPubKey()) << OP_CHECKSIG;
73  standardScripts[1] = GetScriptForDestination(key[1].GetPubKey().GetID());
74  standardScripts[2] << ToByteVector(key[1].GetPubKey()) << OP_CHECKSIG;
75  standardScripts[3] = GetScriptForDestination(key[2].GetPubKey().GetID());
76  CScript evalScripts[4];
77  for (int i = 0; i < 4; i++)
78  {
79  keystore.AddCScript(standardScripts[i]);
80  evalScripts[i] = GetScriptForDestination(CScriptID(standardScripts[i]));
81  }
82 
83  CMutableTransaction txFrom; // Funding transaction:
84  std::string reason;
85  txFrom.vout.resize(8);
86  for (int i = 0; i < 4; i++)
87  {
88  txFrom.vout[i].scriptPubKey = evalScripts[i];
89  txFrom.vout[i].nValue = COIN;
90  txFrom.vout[i+4].scriptPubKey = standardScripts[i];
91  txFrom.vout[i+4].nValue = COIN;
92  }
93  BOOST_CHECK(IsStandardTx(MakeTransactionRef(txFrom), 0, reason));
94 
95  CMutableTransaction txTo[8]; // Spending transactions
96  for (int i = 0; i < 8; i++)
97  {
98  txTo[i].vin.resize(1);
99  txTo[i].vout.resize(1);
100  txTo[i].vin[0].prevout.n = i;
101  txTo[i].vin[0].prevout.hash = txFrom.GetHash();
102  txTo[i].vout[0].nValue = 1;
103  BOOST_CHECK_MESSAGE(IsMine(keystore, txFrom.vout[i].scriptPubKey), strprintf("IsMine %d", i));
104  }
105  for (int i = 0; i < 8; i++)
106  {
107  BOOST_CHECK_MESSAGE(SignSignature(keystore, txFrom, txTo[i], 0, SIGHASH_ALL), strprintf("SignSignature %d", i));
108  }
109  // All of the above should be OK, and the txTos have valid signatures
110  // Check to make sure signature verification fails if we use the wrong ScriptSig:
111  for (int i = 0; i < 8; i++) {
112  PrecomputedTransactionData precomTxData(txTo[i]);
113  for (int j = 0; j < 8; j++) {
114  CScript sigSave = txTo[i].vin[0].scriptSig;
115  txTo[i].vin[0].scriptSig = txTo[j].vin[0].scriptSig;
116  bool sigOK = CScriptCheck(txFrom.vout[txTo[i].vin[0].prevout.n], txTo[i], 0, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC,
117  false, &precomTxData)();
118  if (i == j)
119  BOOST_CHECK_MESSAGE(sigOK, strprintf("VerifySignature %d %d", i, j));
120  else
121  BOOST_CHECK_MESSAGE(!sigOK, strprintf("VerifySignature %d %d", i, j));
122  txTo[i].vin[0].scriptSig = sigSave;
123  }
124  }
125 }
126 
128 {
129  ScriptError err;
130  // Make sure only the outer pay-to-script-hash does the
131  // extra-validation thing:
132  CScript invalidAsScript;
133  invalidAsScript << OP_INVALIDOPCODE << OP_INVALIDOPCODE;
134 
135  CScript p2sh = GetScriptForDestination(CScriptID(invalidAsScript));
136 
137  CScript scriptSig;
138  scriptSig << Serialize(invalidAsScript);
139 
140  // Should not verify, because it will try to execute OP_INVALIDOPCODE
141  BOOST_CHECK(!Verify(scriptSig, p2sh, true, err));
142  BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_BAD_OPCODE, ScriptErrorString(err));
143 
144  // Try to recur, and verification should succeed because
145  // the inner HASH160 <> EQUAL should only check the hash:
147  CScript scriptSig2;
148  scriptSig2 << Serialize(invalidAsScript) << Serialize(p2sh);
149 
150  BOOST_CHECK(Verify(scriptSig2, p2sh2, true, err));
151  BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err));
152 }
153 
155 {
156  LOCK(cs_main);
157  // Test the CScript::Set* methods
158  CBasicKeyStore keystore;
159  CKey key[4];
160  std::vector<CPubKey> keys;
161  for (int i = 0; i < 4; i++)
162  {
163  key[i].MakeNewKey(true);
164  keystore.AddKey(key[i]);
165  keys.push_back(key[i].GetPubKey());
166  }
167 
168  CScript inner[4];
169  inner[0] = GetScriptForDestination(key[0].GetPubKey().GetID());
170  inner[1] = GetScriptForMultisig(2, std::vector<CPubKey>(keys.begin(), keys.begin()+2));
171  inner[2] = GetScriptForMultisig(1, std::vector<CPubKey>(keys.begin(), keys.begin()+2));
172  inner[3] = GetScriptForMultisig(2, std::vector<CPubKey>(keys.begin(), keys.begin()+3));
173 
174  CScript outer[4];
175  for (int i = 0; i < 4; i++)
176  {
177  outer[i] = GetScriptForDestination(CScriptID(inner[i]));
178  keystore.AddCScript(inner[i]);
179  }
180 
181  CMutableTransaction txFrom; // Funding transaction:
182  std::string reason;
183  txFrom.vout.resize(4);
184  for (int i = 0; i < 4; i++)
185  {
186  txFrom.vout[i].scriptPubKey = outer[i];
187  txFrom.vout[i].nValue = CENT;
188  }
189  BOOST_CHECK(IsStandardTx(MakeTransactionRef(txFrom), 0, reason));
190 
191  CMutableTransaction txTo[4]; // Spending transactions
192  for (int i = 0; i < 4; i++)
193  {
194  txTo[i].vin.resize(1);
195  txTo[i].vout.resize(1);
196  txTo[i].vin[0].prevout.n = i;
197  txTo[i].vin[0].prevout.hash = txFrom.GetHash();
198  txTo[i].vout[0].nValue = 1*CENT;
199  txTo[i].vout[0].scriptPubKey = inner[i];
200  BOOST_CHECK_MESSAGE(IsMine(keystore, txFrom.vout[i].scriptPubKey), strprintf("IsMine %d", i));
201  }
202  for (int i = 0; i < 4; i++)
203  {
204  BOOST_CHECK_MESSAGE(SignSignature(keystore, txFrom, txTo[i], 0, SIGHASH_ALL), strprintf("SignSignature %d", i));
205  BOOST_CHECK_MESSAGE(IsStandardTx(MakeTransactionRef(txTo[i]), 0, reason), strprintf("txTo[%d].IsStandard", i));
206  }
207 }
208 
210 {
211  // Test CScript::IsPayToScriptHash()
212  uint160 dummy;
213  CScript p2sh;
214  p2sh << OP_HASH160 << ToByteVector(dummy) << OP_EQUAL;
216 
217  // Not considered pay-to-script-hash if using one of the OP_PUSHDATA opcodes:
218  static const unsigned char direct[] = { OP_HASH160, 20, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, OP_EQUAL };
219  BOOST_CHECK(CScript(direct, direct+sizeof(direct)).IsPayToScriptHash());
220  static const unsigned char pushdata1[] = { OP_HASH160, OP_PUSHDATA1, 20, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, OP_EQUAL };
221  BOOST_CHECK(!CScript(pushdata1, pushdata1+sizeof(pushdata1)).IsPayToScriptHash());
222  static const unsigned char pushdata2[] = { OP_HASH160, OP_PUSHDATA2, 20,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, OP_EQUAL };
223  BOOST_CHECK(!CScript(pushdata2, pushdata2+sizeof(pushdata2)).IsPayToScriptHash());
224  static const unsigned char pushdata4[] = { OP_HASH160, OP_PUSHDATA4, 20,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, OP_EQUAL };
225  BOOST_CHECK(!CScript(pushdata4, pushdata4+sizeof(pushdata4)).IsPayToScriptHash());
226 
227  CScript not_p2sh;
228  BOOST_CHECK(!not_p2sh.IsPayToScriptHash());
229 
230  not_p2sh.clear(); not_p2sh << OP_HASH160 << ToByteVector(dummy) << ToByteVector(dummy) << OP_EQUAL;
231  BOOST_CHECK(!not_p2sh.IsPayToScriptHash());
232 
233  not_p2sh.clear(); not_p2sh << OP_NOP << ToByteVector(dummy) << OP_EQUAL;
234  BOOST_CHECK(!not_p2sh.IsPayToScriptHash());
235 
236  not_p2sh.clear(); not_p2sh << OP_HASH160 << ToByteVector(dummy) << OP_CHECKSIG;
237  BOOST_CHECK(!not_p2sh.IsPayToScriptHash());
238 }
239 
241 {
242  // Test switch over code
243  CScript notValid;
244  ScriptError err;
245  notValid << OP_11 << OP_12 << OP_EQUALVERIFY;
246  CScript scriptSig;
247  scriptSig << Serialize(notValid);
248 
249  CScript fund = GetScriptForDestination(CScriptID(notValid));
250 
251 
252  // Validation should succeed under old rules (hash is correct):
253  BOOST_CHECK(Verify(scriptSig, fund, false, err));
254  BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err));
255  // Fail under new:
256  BOOST_CHECK(!Verify(scriptSig, fund, true, err));
257  BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EQUALVERIFY, ScriptErrorString(err));
258 }
259 
261 {
262  LOCK(cs_main);
263  CCoinsView coinsDummy;
264  CCoinsViewCache coins(&coinsDummy);
265  CBasicKeyStore keystore;
266  CKey key[6];
267  std::vector<CPubKey> keys;
268  for (int i = 0; i < 6; i++)
269  {
270  key[i].MakeNewKey(true);
271  keystore.AddKey(key[i]);
272  }
273  for (int i = 0; i < 3; i++)
274  keys.push_back(key[i].GetPubKey());
275 
276  CMutableTransaction txFrom;
277  txFrom.vout.resize(7);
278 
279  // First three are standard:
280  CScript pay1 = GetScriptForDestination(key[0].GetPubKey().GetID());
281  keystore.AddCScript(pay1);
282  CScript pay1of3 = GetScriptForMultisig(1, keys);
283 
284  txFrom.vout[0].scriptPubKey = GetScriptForDestination(CScriptID(pay1)); // P2SH (OP_CHECKSIG)
285  txFrom.vout[0].nValue = 1000;
286  txFrom.vout[1].scriptPubKey = pay1; // ordinary OP_CHECKSIG
287  txFrom.vout[1].nValue = 2000;
288  txFrom.vout[2].scriptPubKey = pay1of3; // ordinary OP_CHECKMULTISIG
289  txFrom.vout[2].nValue = 3000;
290 
291  // vout[3] is complicated 1-of-3 AND 2-of-3
292  // ... that is OK if wrapped in P2SH:
293  CScript oneAndTwo;
294  oneAndTwo << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey());
295  oneAndTwo << OP_3 << OP_CHECKMULTISIGVERIFY;
296  oneAndTwo << OP_2 << ToByteVector(key[3].GetPubKey()) << ToByteVector(key[4].GetPubKey()) << ToByteVector(key[5].GetPubKey());
297  oneAndTwo << OP_3 << OP_CHECKMULTISIG;
298  keystore.AddCScript(oneAndTwo);
299  txFrom.vout[3].scriptPubKey = GetScriptForDestination(CScriptID(oneAndTwo));
300  txFrom.vout[3].nValue = 4000;
301 
302  // vout[4] is max sigops:
303  CScript fifteenSigops; fifteenSigops << OP_1;
304  for (unsigned i = 0; i < MAX_P2SH_SIGOPS; i++)
305  fifteenSigops << ToByteVector(key[i%3].GetPubKey());
306  fifteenSigops << OP_15 << OP_CHECKMULTISIG;
307  keystore.AddCScript(fifteenSigops);
308  txFrom.vout[4].scriptPubKey = GetScriptForDestination(CScriptID(fifteenSigops));
309  txFrom.vout[4].nValue = 5000;
310 
311  // vout[5/6] are non-standard because they exceed MAX_P2SH_SIGOPS
312  CScript sixteenSigops; sixteenSigops << OP_16 << OP_CHECKMULTISIG;
313  keystore.AddCScript(sixteenSigops);
314  txFrom.vout[5].scriptPubKey = GetScriptForDestination(CScriptID(fifteenSigops));
315  txFrom.vout[5].nValue = 5000;
316  CScript twentySigops; twentySigops << OP_CHECKMULTISIG;
317  keystore.AddCScript(twentySigops);
318  txFrom.vout[6].scriptPubKey = GetScriptForDestination(CScriptID(twentySigops));
319  txFrom.vout[6].nValue = 6000;
320 
321  AddCoins(coins, txFrom, 0);
322 
323  CMutableTransaction txTo;
324  txTo.vout.resize(1);
325  txTo.vout[0].scriptPubKey = GetScriptForDestination(key[1].GetPubKey().GetID());
326 
327  txTo.vin.resize(5);
328  for (int i = 0; i < 5; i++)
329  {
330  txTo.vin[i].prevout.n = i;
331  txTo.vin[i].prevout.hash = txFrom.GetHash();
332  }
333  BOOST_CHECK(SignSignature(keystore, txFrom, txTo, 0, SIGHASH_ALL));
334  BOOST_CHECK(SignSignature(keystore, txFrom, txTo, 1, SIGHASH_ALL));
335  BOOST_CHECK(SignSignature(keystore, txFrom, txTo, 2, SIGHASH_ALL));
336  // SignSignature doesn't know how to sign these. We're
337  // not testing validating signatures, so just create
338  // dummy signatures that DO include the correct P2SH scripts:
339  txTo.vin[3].scriptSig << OP_11 << OP_11 << std::vector<unsigned char>(oneAndTwo.begin(), oneAndTwo.end());
340  txTo.vin[4].scriptSig << std::vector<unsigned char>(fifteenSigops.begin(), fifteenSigops.end());
341 
342  BOOST_CHECK(::AreInputsStandard(txTo, coins));
343  // 22 P2SH sigops for all inputs (1 for vin[0], 6 for vin[3], 15 for vin[4]
344  BOOST_CHECK_EQUAL(GetP2SHSigOpCount(txTo, coins), 22U);
345 
346  CMutableTransaction txToNonStd1;
347  txToNonStd1.vout.resize(1);
348  txToNonStd1.vout[0].scriptPubKey = GetScriptForDestination(key[1].GetPubKey().GetID());
349  txToNonStd1.vout[0].nValue = 1000;
350  txToNonStd1.vin.resize(1);
351  txToNonStd1.vin[0].prevout.n = 5;
352  txToNonStd1.vin[0].prevout.hash = txFrom.GetHash();
353  txToNonStd1.vin[0].scriptSig << std::vector<unsigned char>(sixteenSigops.begin(), sixteenSigops.end());
354 
355  BOOST_CHECK(!::AreInputsStandard(txToNonStd1, coins));
356  BOOST_CHECK_EQUAL(GetP2SHSigOpCount(txToNonStd1, coins), 16U);
357 
358  CMutableTransaction txToNonStd2;
359  txToNonStd2.vout.resize(1);
360  txToNonStd2.vout[0].scriptPubKey = GetScriptForDestination(key[1].GetPubKey().GetID());
361  txToNonStd2.vout[0].nValue = 1000;
362  txToNonStd2.vin.resize(1);
363  txToNonStd2.vin[0].prevout.n = 6;
364  txToNonStd2.vin[0].prevout.hash = txFrom.GetHash();
365  txToNonStd2.vin[0].scriptSig << std::vector<unsigned char>(twentySigops.begin(), twentySigops.end());
366 
367  BOOST_CHECK(!::AreInputsStandard(txToNonStd2, coins));
368  BOOST_CHECK_EQUAL(GetP2SHSigOpCount(txToNonStd2, coins), 20U);
369 }
370 
Basic key store, that keeps keys in an address->secret map.
Definition: keystore.h:99
virtual bool AddCScript(const CScript &redeemScript)
Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki.
Definition: keystore.cpp:41
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Definition: coins.h:283
Abstract view on the open txout dataset.
Definition: coins.h:201
An encapsulated private key.
Definition: key.h:30
void MakeNewKey(bool fCompressed)
Generate a new private key using a cryptographic PRNG.
Definition: key.cpp:158
CPubKey GetPubKey() const
Compute the public key from a private key.
Definition: key.cpp:186
virtual bool AddKey(const CKey &key)
Definition: keystore.cpp:14
Closure representing one script verification Note that this stores references to the spending transac...
Definition: validation.h:273
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:381
bool IsPayToScriptHash() const
Definition: script.cpp:223
void clear()
Definition: script.h:659
A reference to a CScript: the Hash160 of its serialization (see script.h)
Definition: standard.h:24
iterator begin()
Definition: prevector.h:285
iterator end()
Definition: prevector.h:287
160-bit opaque blob.
Definition: uint256.h:127
void AddCoins(CCoinsViewCache &cache, const CTransaction &tx, int nHeight, bool check, bool fSkipInvalid)
Utility function to add all of a transaction's outputs to a cache.
Definition: coins.cpp:116
BOOST_AUTO_TEST_SUITE_END()
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, unsigned int flags, const BaseSignatureChecker &checker, SigVersion sigversion, ScriptError *serror)
@ SCRIPT_VERIFY_P2SH
Definition: interpreter.h:36
@ SCRIPT_VERIFY_STRICTENC
Definition: interpreter.h:41
@ SCRIPT_VERIFY_NONE
Definition: interpreter.h:33
@ SIGHASH_ALL
Definition: interpreter.h:24
isminetype IsMine(const CKeyStore &keystore, const CTxDestination &dest)
Definition: ismine.cpp:29
@ LOCK
Definition: lockunlock.h:16
RecursiveMutex cs_main
Global state.
Definition: validation.cpp:80
#define BOOST_FIXTURE_TEST_SUITE(a, b)
Definition: object.cpp:14
#define BOOST_CHECK_EQUAL(v1, v2)
Definition: object.cpp:18
#define BOOST_CHECK(expr)
Definition: object.cpp:17
bool AreInputsStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check for standard transaction types.
Definition: policy.cpp:191
bool IsStandardTx(const CTransactionRef &tx, int nBlockHeight, std::string &reason)
Check for standard transaction types.
Definition: policy.cpp:100
std::vector< unsigned char > ToByteVector(const T &in)
Definition: script.h:43
@ OP_2
Definition: script.h:61
@ OP_PUSHDATA4
Definition: script.h:56
@ OP_CHECKMULTISIG
Definition: script.h:168
@ OP_CHECKSIG
Definition: script.h:166
@ OP_16
Definition: script.h:75
@ OP_INVALIDOPCODE
Definition: script.h:196
@ OP_EQUAL
Definition: script.h:122
@ OP_NOP
Definition: script.h:78
@ OP_HASH160
Definition: script.h:163
@ OP_1
Definition: script.h:59
@ OP_12
Definition: script.h:71
@ OP_CHECKMULTISIGVERIFY
Definition: script.h:169
@ OP_15
Definition: script.h:74
@ OP_PUSHDATA1
Definition: script.h:54
@ OP_3
Definition: script.h:62
@ OP_11
Definition: script.h:70
@ OP_PUSHDATA2
Definition: script.h:55
@ OP_EQUALVERIFY
Definition: script.h:123
BOOST_AUTO_TEST_CASE(sign)
const char * ScriptErrorString(const ScriptError serror)
Definition: script_error.cpp:9
enum ScriptError_t ScriptError
@ SCRIPT_ERR_EQUALVERIFY
Definition: script_error.h:27
@ SCRIPT_ERR_OK
Definition: script_error.h:12
@ SCRIPT_ERR_BAD_OPCODE
Definition: script_error.h:35
void Serialize(Stream &s, char a)
Definition: serialize.h:237
bool SignSignature(const CKeyStore &keystore, const CScript &fromPubKey, CMutableTransaction &txTo, unsigned int nIn, const CAmount &amount, int nHashType, bool fColdStake)
Produce a script signature for a transaction.
Definition: sign.cpp:192
CScript GetScriptForMultisig(int nRequired, const std::vector< CPubKey > &keys)
Generate a multisig script.
Definition: standard.cpp:311
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a PIVX scriptPubKey for the given CTxDestination.
Definition: standard.cpp:278
A mutable version of CTransaction.
Definition: transaction.h:409
uint256 GetHash() const
Compute the hash of this CMutableTransaction.
Definition: transaction.cpp:96
SigVersion GetRequiredSigVersion() const
Definition: transaction.h:450
std::vector< CTxOut > vout
Definition: transaction.h:411
std::vector< CTxIn > vin
Definition: transaction.h:410
#define strprintf
Definition: tinyformat.h:1056
unsigned int GetP2SHSigOpCount(const CTransaction &tx, const CCoinsViewCache &inputs)
Count ECDSA signature operations in pay-to-script-hash inputs.
Definition: tx_verify.cpp:39