mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-24 22:58:32 +01:00
Change TransactionConfidence.getBroadcastBy() to return a set instead of a list iterator. The latter form is not very convenient.
This commit is contained in:
parent
059b2679a7
commit
c9830cca52
2 changed files with 6 additions and 4 deletions
|
@ -17,6 +17,7 @@
|
|||
|
||||
package org.bitcoinj.core;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import org.bitcoinj.utils.ListenerRegistration;
|
||||
import org.bitcoinj.utils.Threading;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
@ -25,6 +26,7 @@ import com.google.common.util.concurrent.SettableFuture;
|
|||
import javax.annotation.Nullable;
|
||||
import java.io.Serializable;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
|
@ -283,8 +285,9 @@ public class TransactionConfidence implements Serializable {
|
|||
/**
|
||||
* Returns a snapshot of {@link PeerAddress}es that announced the transaction.
|
||||
*/
|
||||
public ListIterator<PeerAddress> getBroadcastBy() {
|
||||
return broadcastBy.listIterator();
|
||||
public Set<PeerAddress> getBroadcastBy() {
|
||||
ListIterator<PeerAddress> iterator = broadcastBy.listIterator();
|
||||
return Sets.newHashSet(iterator);
|
||||
}
|
||||
|
||||
/** Returns true if the given address has been seen via markBroadcastBy() */
|
||||
|
|
|
@ -346,8 +346,7 @@ public class WalletProtobufSerializer {
|
|||
}
|
||||
}
|
||||
|
||||
for (ListIterator<PeerAddress> it = confidence.getBroadcastBy(); it.hasNext();) {
|
||||
PeerAddress address = it.next();
|
||||
for (PeerAddress address : confidence.getBroadcastBy()) {
|
||||
Protos.PeerAddress proto = Protos.PeerAddress.newBuilder()
|
||||
.setIpAddress(ByteString.copyFrom(address.getAddr().getAddress()))
|
||||
.setPort(address.getPort())
|
||||
|
|
Loading…
Add table
Reference in a new issue