Fix ChannelsPayment when destpub issues payment,add check_signing_pubkey

This commit is contained in:
Mihailo Milenkovic
2019-01-18 11:14:40 +01:00
parent cd45dbdf25
commit 6915c400e3
3 changed files with 37 additions and 4 deletions

View File

@@ -599,3 +599,34 @@ bool komodo_txnotarizedconfirmed(uint256 txid)
return (true);
return (false);
}
CPubKey check_signing_pubkey(CScript scriptSig)
{
bool found = false;
CPubKey pubkey;
auto findEval = [](CC *cond, struct CCVisitor _) {
bool r = false;
if (cc_typeId(cond) == CC_Secp256k1) {
*(CPubKey*)_.context=buf2pk(cond->publicKey);
r = true;
}
// false for a match, true for continue
return r ? 0 : 1;
};
CC *cond = GetCryptoCondition(scriptSig);
if (cond) {
CCVisitor visitor = { findEval, (uint8_t*)"", 0, &pubkey };
bool out = !cc_visit(cond, visitor);
cc_free(cond);
if (pubkey.IsValid()) {
return pubkey;
}
}
return CPubKey();
}