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

Feat voting #259

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public boolean process(Coin balanceToDenominate, int outputs, Result<Boolean> ad
// Add output and subtract denomination amount
if (txBuilder.addOutput(denomValue) != null) {
++nOutputs;
++currentDenomIt;
mapDenomCount.put(denomValue, ++currentDenomIt);
balanceToDenominate = balanceToDenominate.subtract(denomValue);
log.info("coinjoin: 1 - denomValue: {}, balanceToDenominate: {}, nOutputs: {}, {}",
denomValue.toFriendlyString(), balanceToDenominate.toFriendlyString(), nOutputs, txBuilder);
Expand All @@ -276,7 +276,10 @@ public boolean process(Coin balanceToDenominate, int outputs, Result<Boolean> ad
for (Map.Entry<Coin, Integer> entry : mapDenomCount.entrySet()) {
// Check if this specific denom could use another loop, check that there aren't nCoinJoinDenomsGoal of this
// denom and that our nValueLeft/balanceToDenominate is enough to create one of these denoms, if so, loop again.
if (entry.getValue() < CoinJoinClientOptions.getDenomsGoal() && txBuilder.couldAddOutput(entry.getKey()) && balanceToDenominate.isGreaterThan(Coin.ZERO)) {
Coin denom = entry.getKey();
Integer count = entry.getValue();
if (count < CoinJoinClientOptions.getDenomsGoal() && txBuilder.couldAddOutput(denom) &&
balanceToDenominate.isGreaterThan(CoinJoin.getSmallestDenomination())) {
finished = false;
log.info("coinjoin: 1 - NOT finished - denomValue: {}, count: {}, balanceToDenominate: {}, {}",
entry.getKey().toFriendlyString(), entry.getValue(), balanceToDenominate.toFriendlyString(), txBuilder);
Expand Down
11 changes: 11 additions & 0 deletions core/src/main/java/org/bitcoinj/wallet/SendRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,17 @@ public static SendRequest assetLock(NetworkParameters params, ECKey publicKey, C
return req;
}

/**
* <p>Creates a new asset lock transaction for a public key with a funding amount.</p>
*/
public static SendRequest assetLock(NetworkParameters params, ECKey publicKey, Coin credits, boolean emptyWallet) {
SendRequest req = new SendRequest();
req.emptyWallet = emptyWallet;
req.tx = new AssetLockTransaction(params, publicKey, credits);
return req;
}


/**
* Construct a SendRequest for a CPFP (child-pays-for-parent) transaction. The resulting transaction is already
* completed, so you should directly proceed to signing and broadcasting/committing the transaction. CPFP is
Expand Down
Loading