Commit c35b725d authored by Andreas Schildbach's avatar Andreas Schildbach

SweepWalletFragment: Fix sweeping a paper wallet creates invalid outpoints.

parent 3e6b13e2
...@@ -423,7 +423,7 @@ public class SweepWalletFragment extends Fragment { ...@@ -423,7 +423,7 @@ public class SweepWalletFragment extends Fragment {
for (final UTXO utxo : sortedUtxos) { for (final UTXO utxo : sortedUtxos) {
Transaction fakeTx = fakeTxns.get(utxo.getHash()); Transaction fakeTx = fakeTxns.get(utxo.getHash());
if (fakeTx == null) { if (fakeTx == null) {
fakeTx = new FakeTransaction(Constants.NETWORK_PARAMETERS, utxo.getHash()); fakeTx = new FakeTransaction(Constants.NETWORK_PARAMETERS, utxo.getHash(), utxo.getHash());
fakeTx.getConfidence().setConfidenceType(ConfidenceType.BUILDING); fakeTx.getConfidence().setConfidenceType(ConfidenceType.BUILDING);
fakeTxns.put(fakeTx.getTxId(), fakeTx); fakeTxns.put(fakeTx.getTxId(), fakeTx);
} }
...@@ -631,16 +631,22 @@ public class SweepWalletFragment extends Fragment { ...@@ -631,16 +631,22 @@ public class SweepWalletFragment extends Fragment {
} }
private static class FakeTransaction extends Transaction { private static class FakeTransaction extends Transaction {
private final Sha256Hash hash; private final Sha256Hash txId, wTxId;
public FakeTransaction(final NetworkParameters params, final Sha256Hash hash) { public FakeTransaction(final NetworkParameters params, final Sha256Hash txId, final Sha256Hash wTxId) {
super(params); super(params);
this.hash = hash; this.txId = txId;
this.wTxId = wTxId;
} }
@Override @Override
public Sha256Hash getHash() { public Sha256Hash getTxId() {
return hash; return txId;
}
@Override
public Sha256Hash getWTxId() {
return wTxId;
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment