Skip to content

Commit

Permalink
Merge pull request #49 from peercoin/v0.3.3
Browse files Browse the repository at this point in the history
don't count sendaddresses for address derivation
  • Loading branch information
Willy authored May 4, 2021
2 parents 2a35d24 + d372268 commit ea453c9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
14 changes: 8 additions & 6 deletions lib/providers/activewallets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,20 @@ class ActiveWallets with ChangeNotifier {
unusedAddress = unusedAddr;
} else {
//not empty, but all used -> create new one
String newAddress = hdWallet
.derivePath("m/0'/${openWallet.addresses.length}/0")
.address;
int numberOfOurAddr = openWallet.addresses
.where((element) => element.isOurs == true)
.length;
String derivePath = "m/0'/$numberOfOurAddr/0";
String newAddress = hdWallet.derivePath(derivePath).address;

final res = openWallet.addresses.firstWhere(
(element) => element.address == newAddress,
orElse: () => null);

if (res != null) {
newAddress = hdWallet
.derivePath("m/0'/${openWallet.addresses.length + 1}/0")
.address;
numberOfOurAddr++;
derivePath = "m/0'/$numberOfOurAddr/0";
newAddress = hdWallet.derivePath(derivePath).address;
}

openWallet.addNewAddress = WalletAddress(
Expand Down
8 changes: 5 additions & 3 deletions lib/screens/addressbook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ class _AddressBookScreenState extends State<AddressBookScreen> {
AppBar buildAppBar(BuildContext context) {
return AppBar(
title: FittedBox(
child: Text(
AppLocalizations.instance
.translate('addressbook_title', {"coin": _walletTitle}),
child: Center(
child: Text(
AppLocalizations.instance
.translate('addressbook_title', {"coin": _walletTitle}),
),
),
),
actions: [
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.3.2+14
version: 0.3.3+15

environment:
sdk: ">=2.7.0 <3.0.0"
Expand Down

0 comments on commit ea453c9

Please sign in to comment.