11
11
#include < script/standard.h>
12
12
#include < uint256.h>
13
13
14
-
15
14
typedef std::vector<unsigned char > valtype;
16
15
17
16
MutableTransactionSignatureCreator::MutableTransactionSignatureCreator (const CMutableTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn) : txTo(txToIn), nIn(nInIn), nHashType(nHashTypeIn), amount(amountIn), checker(txTo, nIn, amountIn) {}
@@ -437,6 +436,18 @@ class DummySignatureCreator final : public BaseSignatureCreator {
437
436
return true ;
438
437
}
439
438
};
439
+
440
+ template <typename M, typename K, typename V>
441
+ bool LookupHelper (const M& map, const K& key, V& value)
442
+ {
443
+ auto it = map.find (key);
444
+ if (it != map.end ()) {
445
+ value = it->second ;
446
+ return true ;
447
+ }
448
+ return false ;
449
+ }
450
+
440
451
}
441
452
442
453
const BaseSignatureCreator& DUMMY_SIGNATURE_CREATOR = DummySignatureCreator();
@@ -460,7 +471,6 @@ bool IsSolvable(const SigningProvider& provider, const CScript& script)
460
471
return false ;
461
472
}
462
473
463
-
464
474
bool PartiallySignedTransaction::IsNull () const
465
475
{
466
476
return !tx && inputs.empty () && outputs.empty () && unknown.empty ();
@@ -618,3 +628,19 @@ bool PublicOnlySigningProvider::GetPubKey(const CKeyID &address, CPubKey& pubkey
618
628
{
619
629
return m_provider->GetPubKey (address, pubkey);
620
630
}
631
+
632
+ bool FlatSigningProvider::GetCScript (const CScriptID& scriptid, CScript& script) const { return LookupHelper (scripts, scriptid, script); }
633
+ bool FlatSigningProvider::GetPubKey (const CKeyID& keyid, CPubKey& pubkey) const { return LookupHelper (pubkeys, keyid, pubkey); }
634
+ bool FlatSigningProvider::GetKey (const CKeyID& keyid, CKey& key) const { return LookupHelper (keys, keyid, key); }
635
+
636
+ FlatSigningProvider Merge (const FlatSigningProvider& a, const FlatSigningProvider& b)
637
+ {
638
+ FlatSigningProvider ret;
639
+ ret.scripts = a.scripts ;
640
+ ret.scripts .insert (b.scripts .begin (), b.scripts .end ());
641
+ ret.pubkeys = a.pubkeys ;
642
+ ret.pubkeys .insert (b.pubkeys .begin (), b.pubkeys .end ());
643
+ ret.keys = a.keys ;
644
+ ret.keys .insert (b.keys .begin (), b.keys .end ());
645
+ return ret;
646
+ }
0 commit comments