Skip to content

Commit

Permalink
Merge #350: Revert "Merge #326: Replace Signatur…
Browse files Browse the repository at this point in the history
0b08150 Revert "Merge #326: Replace Signature with Message Signature" (Tobin C. Harding)

Pull request description:

  …e with Message Signature"

  This reverts commit 05f5b82, reversing changes made to c0fc7cb.

  #326 was broken, I should never have merged it. It also should never have gotten past CI. All blame falls on me.

ACKs for top commit:
  apoelstra:
    ACK 0b08150

Tree-SHA512: d42c6e1c0e21fd6394d295279d13bdc9a3e34e04df13dc2907336f64f68e111cbf80454d25997382a81ceb6da5a8ca6b9fd28f2a489b3a33c9b5e4f68494e827
  • Loading branch information
tcharding committed May 5, 2024
2 parents 33293a5 + 0b08150 commit ce665f1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
4 changes: 2 additions & 2 deletions client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use serde_json;

use crate::bitcoin::address::{NetworkUnchecked, NetworkChecked};
use crate::bitcoin::hashes::hex::FromHex;
use bitcoin::sign_message::MessageSignature;
use crate::bitcoin::secp256k1::ecdsa::Signature;
use crate::bitcoin::{
Address, Amount, Block, OutPoint, PrivateKey, PublicKey, Script, Transaction,
};
Expand Down Expand Up @@ -874,7 +874,7 @@ pub trait RpcApi: Sized {
fn verify_message(
&self,
address: &Address,
signature: &MessageSignature,
signature: &Signature,
message: &str,
) -> Result<bool> {
let args = [address.to_string().into(), signature.to_string().into(), into_json(message)?];
Expand Down
2 changes: 1 addition & 1 deletion integration_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ edition = "2018"

[dependencies]
bitcoincore-rpc = { path = "../client" }
bitcoin = { version = "0.31.0", features = ["serde", "rand", "base64"]}
bitcoin = { version = "0.31.0", features = ["serde", "rand"]}
lazy_static = "1.4.0"
log = "0.4"
14 changes: 1 addition & 13 deletions integration_test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use crate::json::BlockStatsFields as BsFields;
use bitcoin::consensus::encode::{deserialize, serialize_hex};
use bitcoin::hashes::hex::FromHex;
use bitcoin::hashes::Hash;
use bitcoin::sign_message::MessageSignature;
use bitcoin::{secp256k1, ScriptBuf, sighash};
use bitcoin::{
transaction, Address, Amount, Network, OutPoint, PrivateKey, Sequence, SignedAmount,
Expand Down Expand Up @@ -147,7 +146,6 @@ fn main() {
test_get_blockchain_info(&cl);
test_get_new_address(&cl);
test_get_raw_change_address(&cl);
test_verify_message_with_messagesignature(&cl);
test_dump_private_key(&cl);
test_generate(&cl);
test_get_balance_generate_to_address(&cl);
Expand Down Expand Up @@ -218,7 +216,7 @@ fn main() {
test_get_mempool_info(&cl);
test_add_multisig_address(&cl);
//TODO import_multi(

//TODO verify_message(
//TODO encrypt_wallet(&self, passphrase: &str) -> Result<()> {
//TODO get_by_id<T: queryable::Queryable<Self>>(
test_add_node(&cl);
Expand Down Expand Up @@ -1370,16 +1368,6 @@ fn test_add_multisig_address(cl: &Client) {
assert!(cl.add_multisig_address(addresses.len(), &addresses, None, Some(json::AddressType::Bech32)).is_ok());
}

fn test_verify_message_with_messagesignature(cl: &Client) {
let addr: Address = Address::from_str("mm68FdwbpxkVcqjU3fu7iiBGEwrsC6Hk66").unwrap().assume_checked();
let signature = MessageSignature::from_base64(
"H3X+ic7axKtHGIsKiqDq0TmP9HIAkONwunln17ROlvB4SOVVUoG5e79EwAz94x2eERPwqcGJ5rLuWRhIu85pEwE=",)
.expect("a valid signature");
let message = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";

assert!(cl.verify_message(&addr, &signature, message).expect("a valid signature"));
}

#[rustfmt::skip]
fn test_derive_addresses(cl: &Client) {
let descriptor = r"pkh(02e96fe52ef0e22d2f131dd425ce1893073a3c6ad20e8cac36726393dfb4856a4c)#62k9sn4x";
Expand Down

0 comments on commit ce665f1

Please sign in to comment.