Closed DeckerSU closed 1 year ago
Need to implement support of uncompressed P2PK vouts. Made live test for this, transaction:
https://kmdexplorer.io/tx/dc5d8e2d5595956adff513b01ec547145927d3a18439412f2217fcda843c595c
sent 0.1 KMD on RJQMkmENqonyf2m2g5hPSCkntyazbcdTnX using p2pk output:
0.1 KMD
048060e5fd7c86a91b729c565a48b400ccd9cd7537c928e414df63e29f2a35b70f29482311646b3e6c0bc6e3733002c5a953bc4bc3ec27dd1c3f388fa538a7fe0a OP_CHECKSIG
Output of:
ADDR=RJQMkmENqonyf2m2g5hPSCkntyazbcdTnX; curl -s --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getaddressbalance", "params": [{"addresses": ["'$ADDR'"]}] }' -H 'Content-type: application/json' http://127.0.0.1:8232/ | jq .result; curl -s https://kmdexplorer.io/insight-api-komodo/addr/$ADDR/balance | jq '{"balance": .}'
is following:
{ "balance": 0 # zebra } { "balance": 10000000 # explorer }
As for now we have the following implementation:
/// Returns the address that this Script contains, if any. pub fn address(&self) -> Option<TransparentAddress> { if self.0.len() == 25 && self.0[0..3] == [OpCode::Dup as u8, OpCode::Hash160 as u8, 0x14] && self.0[23..25] == [OpCode::EqualVerify as u8, OpCode::CheckSig as u8] { let mut hash = [0; 20]; hash.copy_from_slice(&self.0[3..23]); Some(TransparentAddress::PublicKey(hash)) } else if self.0.len() == 1+0x21+1 // dimxy add support for p2pk for kmd && self.0[0] == 0x21 as u8 && self.0[34] == OpCode::CheckSig as u8 { let mut pk = [0; 33]; pk.copy_from_slice(&self.0[1..34]); Some(TransparentAddress::PublicKey( *ripemd::Ripemd160::digest(Sha256::digest(&pk)).as_ref(), )) ...
Seems we need to add uncompressed p2pk vout check here as well.
fixed in d1e53215b8e90543d62ae514a9231d29f5222177
Need to implement support of uncompressed P2PK vouts. Made live test for this, transaction:
https://kmdexplorer.io/tx/dc5d8e2d5595956adff513b01ec547145927d3a18439412f2217fcda843c595c
sent
0.1 KMD
on RJQMkmENqonyf2m2g5hPSCkntyazbcdTnX using p2pk output:Output of:
is following:
As for now we have the following implementation:
Seems we need to add uncompressed p2pk vout check here as well.