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

full segwit support #953

Merged
merged 12 commits into from
Jun 1, 2021
Merged

full segwit support #953

merged 12 commits into from
Jun 1, 2021

Conversation

shamardy
Copy link
Collaborator

@shamardy shamardy commented May 26, 2021

fixes #826

  • Migrate parity-bitcoin to mm2
  • Add segwit address lib to bitcoin library
  • Add full_segwit param to enable/electrum
  • Add segwit p2wpkh addresses support to my_balance method
  • Add segwit p2wpkh support to withdraw method
  • Add p2wsh support
  • Add segwit support for atomic swaps spending transactions

Copy link
Member

@artemii235 artemii235 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I have few minor remarks and a very important note for future implementation iterations 🙂

mm2src/mm2_bitcoin/keys/src/segwitaddress.rs Outdated Show resolved Hide resolved
mm2src/mm2_bitcoin/chain/Cargo.toml Outdated Show resolved Hide resolved
Cargo.lock Outdated Show resolved Hide resolved
mm2src/mm2_bitcoin/chain/src/indexed_block.rs Outdated Show resolved Hide resolved
mm2src/mm2_bitcoin/chain/src/indexed_header.rs Outdated Show resolved Hide resolved
mm2src/mm2_bitcoin/chain/src/indexed_transaction.rs Outdated Show resolved Hide resolved
mm2src/mm2_bitcoin/script/src/interpreter.rs Outdated Show resolved Hide resolved
mm2src/mm2_bitcoin/keys/src/segwitaddress.rs Outdated Show resolved Hide resolved
mm2src/coins/utxo.rs Outdated Show resolved Hide resolved
mm2src/coins/utxo.rs Outdated Show resolved Hide resolved
@shamardy
Copy link
Collaborator Author

For now whats added to the electrum request is

"address_format": {
   "format": "segwit"
}

when supporting p2wsh in the next iteration I will change it to

"address_format": {
   "format": "segwit",
   "subtype": P2SH | P2WPKH | P2WSH
}

by adding

#[serde(tag = "format")]
pub enum UtxoAddressFormat {
    Standard,
    Segwit  { subtype: String },
    CashAddress { network: String },
}

artemii235
artemii235 previously approved these changes May 28, 2021
Copy link
Member

@artemii235 artemii235 left a comment

Choose a reason for hiding this comment

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

Great 🔥

@artemii235
Copy link
Member

@sergeyboyko0791 Please take a look too 🙂

@artemii235
Copy link
Member

@shamardy 2 minor final notes 🙂

  1. Please fix the git conflict.
  2. Segwit { subtype: String } as the subtype has only a few possible values an enum seems a better replacement of String.

@shamardy
Copy link
Collaborator Author

Yeah, already have the enum here
https://github.com/KomodoPlatform/atomicDEX-API/blob/2297d48b13e746c5d749444cc392d771e74d2b3d/mm2src/mm2_bitcoin/keys/src/segwitaddress.rs#L55
will change its name, use it and add more types to it if needed 👌

Copy link

@sergeyboyko0791 sergeyboyko0791 left a comment

Choose a reason for hiding this comment

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

Looks good! I don't have comments :)

@artemii235 artemii235 merged commit 500650d into dev Jun 1, 2021
@artemii235 artemii235 deleted the mm2.1-full-segwit-support branch June 1, 2021 08:25
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.

3 participants