File tree 1 file changed +7
-1
lines changed
keychain_lib/include/keychain_lib
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -565,6 +565,12 @@ struct keychain_command<command_te::sign_trx> : keychain_command_base
565
565
s_length++;
566
566
s.insert (0 , " 00" );
567
567
}
568
+ auto pub_key = dev::toPublic (private_key);
569
+ std::string prefix;
570
+ if (pub_key[dev::Public::size-1 ]%2 )
571
+ prefix = " 03" ; // y - odd
572
+ else
573
+ prefix = " 02" ; // y - even
568
574
// script_len + signature DER-encoded + pub_key
569
575
ss << std::setw (2 ) << ((int ) script_len)
570
576
<< std::setw (2 ) << ((int ) pushdata_sig)
@@ -578,7 +584,7 @@ struct keychain_command<command_te::sign_trx> : keychain_command_base
578
584
<< s
579
585
<< std::setw (2 ) << ((int ) sig_hash_code)
580
586
<< std::setw (2 ) << ((int ) pushdata_pubkey)
581
- << " 03 " + dev::toPublic (private_key) .hex ().substr (0 ,64 );
587
+ << prefix+ pub_key .hex ().substr (0 ,64 );
582
588
trx += ss.str ();
583
589
trx += a.end_of_vin ;
584
590
}
You can’t perform that action at this time.
0 commit comments