[bisq-network/bisq] Wallet changes for Segwit BSQ implementation (#5109)

Steven Barclay notifications at github.com
Sat Jan 23 20:04:22 CET 2021


<!-- 
- make yourself familiar with the CONTRIBUTING.md if you have not already (https://github.com/bisq-network/bisq/blob/master/CONTRIBUTING.md)
- make sure you follow our [coding style guidelines][https://github.com/bisq-network/style/issues)
- pick a descriptive title
- provide some meaningful PR description below
- create the PR
- in case you receive a "Change request" and/or a NACK, please react within 30 days. If not, we will close your PR and it can not be up for compensation.
- After addressing the change request, __please re-request a review!__ Otherwise we might miss your PR as we tend to only look at pull requests tagged with a "review required".
-->

This is a continuation from #5000, which replaces Bisq's Json RPC client to allow Segwit data (`"txinwitness"` fields) to be retrieved by DAO full nodes, in order to fill in the pubkeys of BSQ tx Segwit inputs (as necessary to support fully Segwit compensation and proof-of-burn txs).

This PR makes the necessary changes to the user's wallet and address formatting + validation to support Segwit BSQ, migrating the wallet upon startup in an analogous way to the Segwit BTC wallet upgrade (#4568). With these changes, newly generated BSQ addresses are native Segwit (p2wpkh) and take the form _'B' + \<bech32-address\>_, e.g.

> Bbc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq **(mainnet)**
> Bbcrt1qj4t04q4mpssfv9uzpm6w2n8rlhs7es47ktqx8x **(regtest)**

They should be valid everywhere the old base58 (p2pkh) BSQ addresses are, which continue to be supported (just never selected as new change or recipient addresses).

--

Note that this PR probably shouldn't be merged into master until the technical hard fork introduced by #5000 activates on mainnet, as otherwise upgraded users will have difficultly generating valid compensation requests or proof-of-burn txs. This is because native Segwit BSQ coins from their wallet may be arbitrarily selected as tx inputs.

You can view, comment on, or merge this pull request online at:

  https://github.com/bisq-network/bisq/pull/5109

-- Commit Summary --

  * Code cleanup: Simplify Optional stream processing
  * Allow use of bech32 BSQ addresses
  * Perform segwit BSQ wallet migration upon startup

-- File Changes --

    M apitest/src/test/java/bisq/apitest/method/wallet/BsqWalletTest.java (4)
    M assets/src/main/java/bisq/asset/coins/BSQ.java (6)
    M core/src/main/java/bisq/core/api/CoreWalletsService.java (15)
    M core/src/main/java/bisq/core/app/BisqSetup.java (4)
    M core/src/main/java/bisq/core/btc/model/BsqTransferModel.java (6)
    M core/src/main/java/bisq/core/btc/setup/BisqKeyChainGroupStructure.java (16)
    M core/src/main/java/bisq/core/btc/setup/WalletConfig.java (39)
    M core/src/main/java/bisq/core/btc/setup/WalletsSetup.java (17)
    M core/src/main/java/bisq/core/btc/wallet/BsqTransferService.java (4)
    M core/src/main/java/bisq/core/btc/wallet/BsqWalletService.java (22)
    M core/src/main/java/bisq/core/btc/wallet/BtcWalletService.java (16)
    M core/src/main/java/bisq/core/dao/governance/period/CycleService.java (3)
    M core/src/main/java/bisq/core/dao/governance/proposal/IssuanceProposal.java (12)
    M core/src/main/java/bisq/core/dao/state/model/blockchain/OpReturnType.java (4)
    M core/src/main/java/bisq/core/dao/state/model/governance/CompensationProposal.java (11)
    M core/src/main/java/bisq/core/dao/state/model/governance/ReimbursementProposal.java (11)
    M core/src/main/java/bisq/core/util/coin/BsqFormatter.java (10)
    M desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxListItem.java (11)
    M desktop/src/main/java/bisq/desktop/util/validation/BsqAddressValidator.java (2)

-- Patch Links --

https://github.com/bisq-network/bisq/pull/5109.patch
https://github.com/bisq-network/bisq/pull/5109.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/5109
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20210123/c48e9a19/attachment-0001.htm>


More information about the bisq-github mailing list