mirror of
https://github.com/RoboSats/taptrade-core.git
synced 2025-07-21 02:03:17 +00:00
add test for keyspend payout
This commit is contained in:
@ -368,6 +368,11 @@ pub async fn handle_payout_signature(
|
|||||||
};
|
};
|
||||||
|
|
||||||
debug!("Keyspend info: {:?}", keyspend_information);
|
debug!("Keyspend info: {:?}", keyspend_information);
|
||||||
|
trace!(
|
||||||
|
"Keyspend agg sig : {} \n Agg pubk: {}",
|
||||||
|
keyspend_information.agg_sig.to_string(),
|
||||||
|
keyspend_information.agg_keyspend_pk.to_string()
|
||||||
|
);
|
||||||
warn!("Use musig2 validate partial sig to validate sigs before using to blame users providing wrong sigs");
|
warn!("Use musig2 validate partial sig to validate sigs before using to blame users providing wrong sigs");
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod db_tests;
|
mod db_tests;
|
||||||
|
|
||||||
use axum::routing::trace;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -22,7 +22,7 @@ async fn new_test_wallet(wallet_xprv: &str) -> CoordinatorWallet<MemoryDatabase>
|
|||||||
username: env::var("BITCOIN_RPC_USER").unwrap(),
|
username: env::var("BITCOIN_RPC_USER").unwrap(),
|
||||||
password: env::var("BITCOIN_RPC_PASSWORD").unwrap(),
|
password: env::var("BITCOIN_RPC_PASSWORD").unwrap(),
|
||||||
},
|
},
|
||||||
network: Regtest,
|
network: Network::Regtest,
|
||||||
// wallet_name: env::var("BITCOIN_RPC_WALLET_NAME")?,
|
// wallet_name: env::var("BITCOIN_RPC_WALLET_NAME")?,
|
||||||
wallet_name: bdk::wallet::wallet_name_from_descriptor(
|
wallet_name: bdk::wallet::wallet_name_from_descriptor(
|
||||||
Bip86(wallet_xprv, KeychainKind::External),
|
Bip86(wallet_xprv, KeychainKind::External),
|
||||||
@ -339,7 +339,7 @@ fn test_create_escrow_spending_psbt() {
|
|||||||
username: env::var("BITCOIN_RPC_USER").unwrap(),
|
username: env::var("BITCOIN_RPC_USER").unwrap(),
|
||||||
password: env::var("BITCOIN_RPC_PASSWORD").unwrap(),
|
password: env::var("BITCOIN_RPC_PASSWORD").unwrap(),
|
||||||
},
|
},
|
||||||
network: Regtest,
|
network: Network::Regtest,
|
||||||
// wallet_name: env::var("BITCOIN_RPC_WALLET_NAME")?,
|
// wallet_name: env::var("BITCOIN_RPC_WALLET_NAME")?,
|
||||||
wallet_name: bdk::wallet::wallet_name_from_descriptor(
|
wallet_name: bdk::wallet::wallet_name_from_descriptor(
|
||||||
test_descriptor,
|
test_descriptor,
|
||||||
@ -359,3 +359,11 @@ fn test_create_escrow_spending_psbt() {
|
|||||||
dbg!(&escrow_utxo);
|
dbg!(&escrow_utxo);
|
||||||
assert!(escrow_utxo.len() > 0);
|
assert!(escrow_utxo.len() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[allow(unused)]
|
||||||
|
fn test_signing_keyspend_payout() {
|
||||||
|
let keyspend_payout = PartiallySignedTransaction::from_str("cHNidP8BAIkBAAAAAY+TZIhOwH4s+pwY3IyReX+uTDcTk/Z0uyR+8nMry1SFAgAAAAD+////ApgIAAAAAAAAIlEgFnkGWGJhc3wojQDfZ5/ZHeFozXkveTMP6yEHi3Gzo7A4jwEAAAAAACJRICTtYuOGKvI2WT//MicE6aMb2W5KEhmf55LFdApZj+tKoggAAAABASuwrQEAAAAAACJRICy8+LA5padCPyw6dB0oMiZVV3zATeY+q83+7H4kiAQzYhXA8AlJ1t0c6ZoD+IoaT1kRfVU7DaUXKLt/1bmPv1QTN/tFsKZjNKhUZWQ0TslhZ1I5Kt1rGUZOlBUctAWL70dZ7kzhGQ99VWndyHBjT06XjMNhkpiuLWZT3vXWNLhoyTl5RSDx8dsIEmrxBZdM3mAhCWUl7TkM+bfN5f7bF6CxbtMRUa0gN6bkMMmVP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BQCETUSTIRbx8dsIEmrxBZdM3mAhCWUl7TkM+bfN5f7bF6CxbtMRUUUCmPR2eQUaNlmSb3d4eE/r+h6439yHjZsXF3KIAfiWLCib9OAVg7whO/4eOawUxxjxx5y98Nr5fqsMtr5jOjgWOGyh2C0BFyDwCUnW3RzpmgP4ihpPWRF9VTsNpRcou3/VuY+/VBM3+wEYIAOftg8wJKEbEYW4XjrBpfwVkPwEJaZiYmlU0fM8ljA/AAAA").unwrap();
|
||||||
|
let agg_sig = LiftedSignature::from_str("918862505ef919959328f29af4ff2b0bfedaec4489c8db8e3bee33d7ea49aea899ee1cf6ddfad8684f195094945e177378c3c743527f23137e972d7af5546de4").unwrap();
|
||||||
|
let agg_pubk_ctx = KeyAggContext::from_str("0000000002034987f3de20a9b1fa6f76c6758934953a8d615e415f1a656f0f6563694b53107d02f1f1db08126af105974cde6021096525ed390cf9b7cde5fedb17a0b16ed31151").unwrap();
|
||||||
|
}
|
||||||
|
1
todos.md
1
todos.md
@ -1,6 +1,7 @@
|
|||||||
Thinks to improve when implementing the production ready library/coordinator:
|
Thinks to improve when implementing the production ready library/coordinator:
|
||||||
* secure user authentification scheme for calls / unique trade ids
|
* secure user authentification scheme for calls / unique trade ids
|
||||||
* make api more generic (smaller) / maybe use websockets
|
* make api more generic (smaller) / maybe use websockets
|
||||||
|
* make bond punishment logic more advanced (raising fees, quicker monitoring, redundant mempools?)
|
||||||
* review escrow output descriptor, maybe make it smaller(less specific cases, more generic)?
|
* review escrow output descriptor, maybe make it smaller(less specific cases, more generic)?
|
||||||
* maybe hard code descriptor instead of compiling it from pieces?
|
* maybe hard code descriptor instead of compiling it from pieces?
|
||||||
* review for security flaws (error handling, logic bugs, crypto bugs)
|
* review for security flaws (error handling, logic bugs, crypto bugs)
|
||||||
|
Reference in New Issue
Block a user