Skip to content

Commit

Permalink
Fixes for exchange address implementation (#1375)
Browse files Browse the repository at this point in the history
* Fixed wallet address book for exchange addresses

* Fixed testnet exchange address prefix

* Change error text
  • Loading branch information
psolstice authored Dec 17, 2023
1 parent 39c41e5 commit 9a2377c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ class CTestNetParams : public CChainParams {

base58Prefixes[PUBKEY_ADDRESS] = std::vector < unsigned char > (1, 65);
base58Prefixes[SCRIPT_ADDRESS] = std::vector < unsigned char > (1, 178);
base58Prefixes[EXCHANGE_PUBKEY_ADDRESS] = {0x01, 0xb9, 0xbb}; // EXT prefix for the address
base58Prefixes[EXCHANGE_PUBKEY_ADDRESS] = {0x01, 0xb9, 0xb1}; // EXT prefix for the address
base58Prefixes[SECRET_KEY] = std::vector < unsigned char > (1, 185);
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container < std::vector < unsigned char > > ();
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container < std::vector < unsigned char > > ();
Expand Down
2 changes: 1 addition & 1 deletion src/spark/sparkwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,7 @@ CWalletTx CSparkWallet::CreateSparkSpendTransaction(
auto& recipient = recipients[i];

if (recipient.scriptPubKey.IsPayToExchangeAddress()) {
throw std::runtime_error("Cannot create private transaction with exchange address as a destination");
throw std::runtime_error("Exchange addresses cannot receive private funds. Please transfer your funds to a transparent address first before sending to an Exchange address");
}

if (!MoneyRange(recipient.nAmount)) {
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/lelantusjoinsplitbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ CWalletTx LelantusJoinSplitBuilder::Build(
auto& recipient = recipients[i];

if (recipient.scriptPubKey.IsPayToExchangeAddress()) {
throw std::runtime_error("Cannot create private transaction with exchange address as a destination");
throw std::runtime_error("Exchange addresses cannot receive private funds. Please transfer your funds to a transparent address first before sending to an Exchange address");
}

if (!MoneyRange(recipient.nAmount)) {
Expand Down
2 changes: 2 additions & 0 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ UniValue getnewexchangeaddress(const JSONRPCRequest& request)
CBitcoinAddress newAddress;
newAddress.SetExchange(keyID);

pwallet->SetAddressBook(newAddress.Get(), "", "receive");

return newAddress.ToString();
}

Expand Down

0 comments on commit 9a2377c

Please sign in to comment.