-
Notifications
You must be signed in to change notification settings - Fork 0
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
Balance for p2c #28
Balance for p2c #28
Conversation
Pull Request Test Coverage Report for Build 10440638704Details
💛 - Coveralls |
c0b8944
to
9e300a6
Compare
9e300a6
to
b33c8c9
Compare
crates/wallet/src/wallet/mod.rs
Outdated
@@ -2660,6 +2683,17 @@ impl Wallet { | |||
&self.indexed_graph.index | |||
} | |||
|
|||
/// Insert a descriptor with a keychain associated to it. | |||
pub fn insert_descriptor( |
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.
外からは呼ば差なそうなので pub をつけなくてもよいかと思いました。
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.
別の指摘に従い、メソッド自体を削除しました。
crates/wallet/tests/common.rs
Outdated
@@ -296,6 +296,208 @@ pub fn get_funded_wallet_with_reissuable_and_change( | |||
|
|||
(wallet, tx1.txid(), color_id) | |||
} | |||
|
|||
fn get_p2c_address(wallet: &mut Wallet, color_id: Option<ColorIdentifier>) -> Address { | |||
let payment_base = |
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.
wallet.store_contract() でwallet に追加するコントラクトのpayment_baseは、wallet で管理している秘密鍵に対応する公開鍵であることを想定していました。そうでないと、p2cアドレスあてのUTXOを送金できないので。
仕様には記載していませんでしたが、store_contract()でうけとった payment_base がウォレットで管理している鍵でない場合、エラーにするバリデーション処理を加えた方が安全な気がしました。
どう思われますか?
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.
バリデーション処理を追加しました。
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.
f559dc8 でメソッドの位置を変更しました。
crates/wallet/src/wallet/mod.rs
Outdated
let (descriptor, _) = | ||
Descriptor::<DescriptorPublicKey>::parse_descriptor(&self.secp, &descriptor_str) | ||
.unwrap(); | ||
let _ = self.insert_descriptor(KeychainKind::External, descriptor); |
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.
すでに wallet に KeychainKind::External な keychain が設定されている場合、新たに追加するのではなく、上書きしてしまうことになりませんか?
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.
上記の理由からinsert_descriptorを使わず、indexerにpayment_baseと対応するp2c scriptの対応をマップ化して保持するように修正しました。
33005cc
to
1434489
Compare
1434489
to
05cc6b7
Compare
52a4dc5
to
f559dc8
Compare
#31 でマージしました。 |
Description
The PR adds an update to include coins transferred to a P2C address in the balance.
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features:
Bugfixes: