Skip to content

Conversation

@wszdexdrf
Copy link
Contributor

Also made necessary changes to automation.json (for ledger devices). Add
deserializing method for PSBT.

Copy link
Member

@danielabrozzoni danielabrozzoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK, a few comments.

Once again, stop putting everything in a single commit! This PR should have been separated in 3 commits: one for deserialize, one for the automation.json, one for the test itself.

src/lib.rs Outdated
bip32_derivation: hd_keypaths,
..Default::default()
}],
outputs: vec![Output::default(), Output::default()],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add one TxOut to the transaction, and here put only one Output::default()


#[derive(Clone, Eq, PartialEq, Debug, Deserialize)]
pub struct HWIPartiallySignedTransaction {
#[serde(deserialize_with = "deserialize_psbt")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it shouldn't be needed, but it doesn't work without it. Serde complains that expected struct PartiallySignedTransaction while deserializing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mh, weird. Ok to leave it like that then

@wszdexdrf wszdexdrf force-pushed the signtx branch 2 times, most recently from 93519b3 to a347f10 Compare July 3, 2022 05:05
@wszdexdrf
Copy link
Contributor Author

Once again, stop putting everything in a single commit!

I apologize for being lazy. I will keep it in mind. 🙇


#[derive(Clone, Eq, PartialEq, Debug, Deserialize)]
pub struct HWIPartiallySignedTransaction {
#[serde(deserialize_with = "deserialize_psbt")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mh, weird. Ok to leave it like that then

src/lib.rs Outdated
version: 1,
lock_time: 0,
input: vec![txin],
output: vec![],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you should put a txout

src/lib.rs Outdated
}],
};

let txin = TxIn {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would call this "previous_txin", so it's easier to understand that it's not the current tx's txin

src/lib.rs Outdated
// Here device fingerprint is same as master xpub fingerprint
hd_keypaths.insert(pk.public_key, (device.fingerprint, derivation_path));

let tx = Transaction {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be called previous_tx

src/lib.rs Outdated
Comment on lines 193 to 196
xpub: Default::default(),
version: 0,
proprietary: BTreeMap::new(),
unknown: BTreeMap::new(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably use default on those?

@danielabrozzoni
Copy link
Member

utACK a1a1454

@danielabrozzoni danielabrozzoni merged commit 6fea740 into bitcoindevkit:master Jul 6, 2022
@wszdexdrf wszdexdrf deleted the signtx branch July 18, 2022 16:30
binary-hunter347iu added a commit to binary-hunter347iu/rust-hwi that referenced this pull request Sep 28, 2025
a1a1454df6f6bbcec252be289bd1231573452551 Add test for sign_tx (wszdexdrf)
43bd5797acfc9f829622ac7e01bbf25c411c77a5 Add deserialize function for PSBT (wszdexdrf)
8d3c29bad501170835161a1be0c5b0325a1b4ab1 Change `automation.json` for signing tx. (wszdexdrf)

Pull request description:

  Also made necessary changes to automation.json (for ledger devices). Add
  deserializing method for PSBT.

ACKs for top commit:
  danielabrozzoni:
    utACK a1a1454df6f6bbcec252be289bd1231573452551

Tree-SHA512: 2d222006918c420d3d1cc21b7dc09494445791c10d067ba412551d419a3217e682ee73dce4fbc215cf8f1e20c32e828e1a3d76968e07999dfc0a8374ad93dd86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants