3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-07 14:54:15 +00:00

Add a TransactionBroadcaster abstraction to PeerGroup.

This commit is contained in:
Matt Corallo 2013-06-26 23:55:34 +02:00
parent 7cd38bc77a
commit 880b413b24
2 changed files with 29 additions and 1 deletions

View File

@ -67,7 +67,7 @@ import static com.google.common.base.Preconditions.checkState;
* when finished. Note that not all methods of PeerGroup are safe to call from a UI thread as some may do
* network IO, but starting and stopping the service should be fine.</p>
*/
public class PeerGroup extends AbstractIdleService {
public class PeerGroup extends AbstractIdleService implements TransactionBroadcaster {
private static final int DEFAULT_CONNECTIONS = 4;
private static final Logger log = LoggerFactory.getLogger(PeerGroup.class);

View File

@ -0,0 +1,28 @@
/*
* Copyright 2013 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.bitcoin.core;
import com.google.common.util.concurrent.ListenableFuture;
/**
* A general interface which declares the ability to broadcast transactions. This is implemented
* by {@link com.google.bitcoin.core.PeerGroup}.
*/
public interface TransactionBroadcaster {
/** Broadcast the given transaction on the network */
public ListenableFuture<Transaction> broadcastTransaction(final Transaction tx);
}