-
Notifications
You must be signed in to change notification settings - Fork 94
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
[r2r] Include maker/taker pubkeys in MM2.db stats_swaps table #1665
Changes from 6 commits
430b2a9
4bf3833
630a9fe
b9a233e
c860d15
12b2b41
0c642a2
6b057da
dc612e9
f39c52d
76d0929
4aa8539
ef088e3
a581dfb
fe856bf
275bf27
012c2a3
526ffa0
12ec822
5f5a3ea
f40f582
0e3f647
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,6 +115,7 @@ use my_swaps_storage::{MySwapsOps, MySwapsStorage}; | |
use pubkey_banning::BanReason; | ||
pub use pubkey_banning::{ban_pubkey_rpc, is_pubkey_banned, list_banned_pubkeys_rpc, unban_pubkeys_rpc}; | ||
pub use recreate_swap_data::recreate_swap_data; | ||
use rpc::v1::types::H264 as H264Json; | ||
pub use saved_swap::{SavedSwap, SavedSwapError, SavedSwapIo, SavedSwapResult}; | ||
pub use swap_watcher::{process_watcher_msg, watcher_topic, TakerSwapWatcherData, MAKER_PAYMENT_SPEND_FOUND_LOG, | ||
MAKER_PAYMENT_SPEND_SENT_LOG, TAKER_PAYMENT_REFUND_SENT_LOG, TAKER_SWAP_ENTRY_TIMEOUT, | ||
|
@@ -711,12 +712,25 @@ pub struct NegotiationDataV3 { | |
taker_coin_htlc_pub: Vec<u8>, | ||
} | ||
|
||
#[derive(Clone, Debug, Eq, Deserialize, PartialEq, Serialize)] | ||
pub struct NegotiationDataV4 { | ||
started_at: u64, | ||
payment_locktime: u64, | ||
secret_hash: Vec<u8>, | ||
maker_coin_swap_contract: Vec<u8>, | ||
taker_coin_swap_contract: Vec<u8>, | ||
maker_coin_htlc_pub: Vec<u8>, | ||
taker_coin_htlc_pub: Vec<u8>, | ||
persistent_pubkey: Vec<u8>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please try to avoid adding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. waiting for @shamardy feedback on this... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with @sergeyboyko0791 here. Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @borngraced is this PR ready for review? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh sorry, I missed that! and yes it's ready for review. |
||
} | ||
|
||
#[derive(Clone, Debug, Eq, Deserialize, PartialEq, Serialize)] | ||
#[serde(untagged)] | ||
pub enum NegotiationDataMsg { | ||
V1(NegotiationDataV1), | ||
V2(NegotiationDataV2), | ||
V3(NegotiationDataV3), | ||
V4(NegotiationDataV4), | ||
} | ||
|
||
impl NegotiationDataMsg { | ||
|
@@ -725,6 +739,7 @@ impl NegotiationDataMsg { | |
NegotiationDataMsg::V1(v1) => v1.started_at, | ||
NegotiationDataMsg::V2(v2) => v2.started_at, | ||
NegotiationDataMsg::V3(v3) => v3.started_at, | ||
NegotiationDataMsg::V4(v4) => v4.started_at, | ||
} | ||
} | ||
|
||
|
@@ -733,6 +748,7 @@ impl NegotiationDataMsg { | |
NegotiationDataMsg::V1(v1) => v1.payment_locktime, | ||
NegotiationDataMsg::V2(v2) => v2.payment_locktime, | ||
NegotiationDataMsg::V3(v3) => v3.payment_locktime, | ||
NegotiationDataMsg::V4(v4) => v4.payment_locktime, | ||
} | ||
} | ||
|
||
|
@@ -741,6 +757,7 @@ impl NegotiationDataMsg { | |
NegotiationDataMsg::V1(v1) => &v1.secret_hash, | ||
NegotiationDataMsg::V2(v2) => &v2.secret_hash, | ||
NegotiationDataMsg::V3(v3) => &v3.secret_hash, | ||
NegotiationDataMsg::V4(v4) => &v4.secret_hash, | ||
} | ||
} | ||
|
||
|
@@ -749,6 +766,7 @@ impl NegotiationDataMsg { | |
NegotiationDataMsg::V1(v1) => &v1.persistent_pubkey, | ||
NegotiationDataMsg::V2(v2) => &v2.persistent_pubkey, | ||
NegotiationDataMsg::V3(v3) => &v3.maker_coin_htlc_pub, | ||
NegotiationDataMsg::V4(v4) => &v4.maker_coin_htlc_pub, | ||
} | ||
} | ||
|
||
|
@@ -757,6 +775,7 @@ impl NegotiationDataMsg { | |
NegotiationDataMsg::V1(v1) => &v1.persistent_pubkey, | ||
NegotiationDataMsg::V2(v2) => &v2.persistent_pubkey, | ||
NegotiationDataMsg::V3(v3) => &v3.taker_coin_htlc_pub, | ||
NegotiationDataMsg::V4(v4) => &v4.taker_coin_htlc_pub, | ||
} | ||
} | ||
|
||
|
@@ -765,6 +784,7 @@ impl NegotiationDataMsg { | |
NegotiationDataMsg::V1(_) => None, | ||
NegotiationDataMsg::V2(v2) => Some(&v2.maker_coin_swap_contract), | ||
NegotiationDataMsg::V3(v3) => Some(&v3.maker_coin_swap_contract), | ||
NegotiationDataMsg::V4(v4) => Some(&v4.maker_coin_swap_contract), | ||
} | ||
} | ||
|
||
|
@@ -773,6 +793,16 @@ impl NegotiationDataMsg { | |
NegotiationDataMsg::V1(_) => None, | ||
NegotiationDataMsg::V2(v2) => Some(&v2.taker_coin_swap_contract), | ||
NegotiationDataMsg::V3(v3) => Some(&v3.taker_coin_swap_contract), | ||
NegotiationDataMsg::V4(v4) => Some(&v4.taker_coin_swap_contract), | ||
} | ||
} | ||
|
||
pub fn persistent_pubkey(&self) -> Option<&[u8]> { | ||
match self { | ||
NegotiationDataMsg::V1(v1) => Some(&v1.persistent_pubkey), | ||
NegotiationDataMsg::V2(v2) => Some(&v2.persistent_pubkey), | ||
NegotiationDataMsg::V4(v4) => Some(&v4.persistent_pubkey), | ||
NegotiationDataMsg::V3(_) => None, | ||
} | ||
} | ||
} | ||
|
@@ -1380,6 +1410,12 @@ fn detect_secret_hash_algo(maker_coin: &MmCoinEnum, taker_coin: &MmCoinEnum) -> | |
} | ||
} | ||
|
||
#[derive(Debug, Deserialize, PartialEq, Serialize, Default)] | ||
shamardy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pub struct SwapPubkeys { | ||
pub maker: H264Json, | ||
pub taker: H264Json, | ||
} | ||
|
||
#[cfg(all(test, not(target_arch = "wasm32")))] | ||
mod lp_swap_tests { | ||
use super::*; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't just
"ALTER TABLE stats_swaps ADD COLUMN maker_pubkey VARCHAR(255), ADD COLUMN taker_pubkey VARCHAR(255);
work?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes thanks.. it could be this also, but I followed a convention that I already used before https://github.com/KomodoPlatform/atomicDEX-API/blob/54081307cd093cce321939b618a684ad16c915a7/mm2src/mm2_main/src/database/stats_swaps.rs#L49-L52