Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Merge rust-bitcoin/rust-bitcoincore-rpc#326: Replace Signatur… #350

Merged
merged 1 commit into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading