1111#include < script/standard.h>
1212#include < uint256.h>
1313
14-
1514typedef std::vector<unsigned char > valtype;
1615
1716MutableTransactionSignatureCreator::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 {
437436 return true ;
438437 }
439438};
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+
440451}
441452
442453const BaseSignatureCreator& DUMMY_SIGNATURE_CREATOR = DummySignatureCreator();
@@ -460,7 +471,6 @@ bool IsSolvable(const SigningProvider& provider, const CScript& script)
460471 return false ;
461472}
462473
463-
464474bool PartiallySignedTransaction::IsNull () const
465475{
466476 return !tx && inputs.empty () && outputs.empty () && unknown.empty ();
@@ -618,3 +628,19 @@ bool PublicOnlySigningProvider::GetPubKey(const CKeyID &address, CPubKey& pubkey
618628{
619629 return m_provider->GetPubKey (address, pubkey);
620630}
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