mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-08-01 12:31:23 +00:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
f18c19f526 | ||
|
52cec27046 | ||
|
2805e87989 | ||
|
b4cfc48eb7 | ||
|
e03fdde6b0 | ||
|
97cf1abd79 | ||
|
7fb9b6c5ce | ||
|
15dc260cde | ||
|
e7b3a49ab7 |
111
AUTHORS
111
AUTHORS
@@ -1,43 +1,68 @@
|
||||
Mike Hearn <mike@plan99.net>
|
||||
Miron Cuperman (a.k.a. devrandom) <c1.devrandom@niftybox.net>
|
||||
Xiaofeng Guo <xiaofengguo@google.com>
|
||||
Thilo Planz <thilo@cpan.org>
|
||||
Micheal Swiggs <bobby.simpson87@gmail.com>
|
||||
Gary Rowe <g.rowe@froot.co.uk>
|
||||
Noa Resare <noa@resare.com>
|
||||
John Sample <jwsample@gmail.com>
|
||||
Jan Møller <jan.moller@gmail.com>
|
||||
Wolfgang Nagele <wolfgang.nagele@gmail.com>
|
||||
Jonny Heggheim <hegjon@gmail.com>
|
||||
Steve Coughlan <shadders.del@gmail.com>
|
||||
Roman Mandeleil <roman.mandeleil@gmail.com>
|
||||
Chris Rico <chrisrico@gmail.com>
|
||||
Vasile Rotaru <vrotaru.md@gmail.com>
|
||||
Joseph Gleason <fireduck@gmail.com>
|
||||
Mark van Cuijk <phedny@gmail.com>
|
||||
Matt Corallo <git@bluematt.me>
|
||||
Alexander Lolis <alexander.lolis@gmail.com>
|
||||
Matija Mazi <matija.mazi@gmail.com>
|
||||
Eric William Dickerson <eric.w.dickerson@gmail.com>
|
||||
Ken Sedgwick <ken@bonsai.com>
|
||||
Mike Rosseel <mike.rosseel@gmx.net>
|
||||
Mike Belshe <mike@belshe.com>
|
||||
Kevin Greene <kgreenek@gmail.com>
|
||||
Alex Taylor <alex@bitpos.me>
|
||||
Andreas Schildbach <andreas@schildbach.de>
|
||||
Eric Tierney <eztierney@circle.com>
|
||||
Mora Zyx <bitcoinmonk@gmail.com>
|
||||
Peter Dettman <peter.dettman@gmail.com>
|
||||
Piotrek Włodarek <qertoip@gmail.com>
|
||||
Adam Mackler <adammackler@gmail.com>
|
||||
Kosta Korenkov a.k.a troggy <7r0ggy@gmail.com>
|
||||
Harald Hoyer <harald@harald-hoyer.de>
|
||||
Kalpesh Parmar <kparmar1@hotmail.com>
|
||||
Giannis Dzegoutanis <erasmospunk@gmail.com>
|
||||
Oscar Guindzberg <oscar.guindzberg@gmail.com>
|
||||
Richard Green <richardagreen@gmail.com>
|
||||
Martin Zachrison <zac@cyberzac.se>
|
||||
Michael Bumann <michael@railslove.com>
|
||||
Bennett Hoffman <bennett@buttercoin.com>
|
||||
Olle Kullberg <olle.kullberg@strawpay.com>
|
||||
Carlos Lopez <c.lopez@kmels.net>
|
||||
$ git log --format='%aN' | sort -u
|
||||
|
||||
Aaron Voisine
|
||||
Adam Mackler
|
||||
Alexander Lolis
|
||||
Alex Taylor
|
||||
Alon Muroch
|
||||
Amichai Rothman
|
||||
Andreas Schildbach
|
||||
Bennett Hoffman
|
||||
Carlos Lopez-Camey
|
||||
Carsten Otto
|
||||
cyberzac
|
||||
Dave Collins
|
||||
Diego Basch
|
||||
elbandi
|
||||
eleetas
|
||||
En-Ran Zhou
|
||||
Erik Tierney
|
||||
Fireduck
|
||||
freak
|
||||
Gary Rowe
|
||||
Giannis Dzegoutanis
|
||||
gubatron
|
||||
Harald Hoyer
|
||||
Jakob Stuber
|
||||
Jameson Lopp
|
||||
Jarl Fransson
|
||||
Jim Burton
|
||||
Jiri Peinlich
|
||||
Johnathan
|
||||
Jonny Heggheim
|
||||
Justas
|
||||
Kalpesh Parmar
|
||||
Ken Sedgwick
|
||||
Kevin Greene
|
||||
Kosta Korenkov
|
||||
Loco
|
||||
Manfred Karrer
|
||||
Martin Zachrison
|
||||
matija.mazi@gmail.com
|
||||
Matt Corallo
|
||||
Michael Bell
|
||||
Michael Bumann
|
||||
Mike Hearn
|
||||
Mike Rosseel
|
||||
Miron Cuperman
|
||||
monk
|
||||
Mora Zyx
|
||||
ollekullberg
|
||||
Oscar Guindzberg
|
||||
Pavol Rusnak
|
||||
Peter Dettman
|
||||
Peter Stockli
|
||||
Peter Todd
|
||||
Piotr Włodarek
|
||||
Richard Green
|
||||
Ross Nicoll
|
||||
Sean Gilligan
|
||||
Sebastian Ortega
|
||||
Simon de la Rouviere
|
||||
Simon Vermeersch
|
||||
Stephen Reed
|
||||
troggy
|
||||
Tyler Houlihan
|
||||
Wojciech Langiewicz
|
||||
Xiaofeng Guo
|
||||
Ximo Guanter
|
||||
|
@@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.bitcoinj</groupId>
|
||||
<artifactId>bitcoinj-parent</artifactId>
|
||||
<version>0.13-SNAPSHOT</version>
|
||||
<version>0.13.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>bitcoinj-core</artifactId>
|
||||
@@ -479,7 +479,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bitcoinj</groupId>
|
||||
<artifactId>orchid</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp</groupId>
|
||||
|
@@ -2,8 +2,7 @@ package org.bitcoinj.core;
|
||||
|
||||
import org.slf4j.*;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
|
||||
// TODO: Finish adding Context c'tors to all the different objects so we can start deprecating the versions that take NetworkParameters.
|
||||
// TODO: Add a working directory notion to Context and make various subsystems that want to use files default to that directory (eg. Orchid, block stores, wallet, etc).
|
||||
@@ -109,11 +108,8 @@ public class Context {
|
||||
* want to create core BitcoinJ objects. Generally, if a class can accept a Context in its constructor and might
|
||||
* be used (even indirectly) by a thread, you will want to call this first. Your task may be simplified by using
|
||||
* a {@link org.bitcoinj.utils.ContextPropagatingThreadFactory}.
|
||||
*
|
||||
* @throws java.lang.IllegalStateException if this thread already has a context
|
||||
*/
|
||||
public static void propagate(Context context) {
|
||||
checkState(slot.get() == null);
|
||||
slot.set(checkNotNull(context));
|
||||
}
|
||||
|
||||
|
@@ -150,8 +150,12 @@ public class Transaction extends ChildMessage implements Serializable {
|
||||
/** Transaction that makes a pledge to an assurance contract. */
|
||||
ASSURANCE_CONTRACT_PLEDGE,
|
||||
/** Send-to-self transaction that exists just to create an output of the right size we can pledge. */
|
||||
ASSURANCE_CONTRACT_STUB
|
||||
// In future: de/refragmentation, privacy boosting/mixing, child-pays-for-parent fees, etc.
|
||||
ASSURANCE_CONTRACT_STUB,
|
||||
/** Raise fee, e.g. child-pays-for-parent. */
|
||||
RAISE_FEE,
|
||||
// In future: de/refragmentation, privacy boosting/mixing, etc.
|
||||
// When adding a value, it also needs to be added to wallet.proto, WalletProtobufSerialize.makeTxProto()
|
||||
// and WalletProtobufSerializer.readTransaction()!
|
||||
}
|
||||
|
||||
private Purpose purpose = Purpose.UNKNOWN;
|
||||
|
@@ -75,7 +75,7 @@ public class VersionMessage extends Message {
|
||||
public boolean relayTxesBeforeFilter;
|
||||
|
||||
/** The version of this library release, as a string. */
|
||||
public static final String BITCOINJ_VERSION = "0.13-SNAPSHOT";
|
||||
public static final String BITCOINJ_VERSION = "0.13.1";
|
||||
/** The value that is prepended to the subVer field of this application. */
|
||||
public static final String LIBRARY_SUBVER = "/bitcoinj:" + BITCOINJ_VERSION + "/";
|
||||
|
||||
|
@@ -299,6 +299,7 @@ public class WalletProtobufSerializer {
|
||||
case ASSURANCE_CONTRACT_CLAIM: purpose = Protos.Transaction.Purpose.ASSURANCE_CONTRACT_CLAIM; break;
|
||||
case ASSURANCE_CONTRACT_PLEDGE: purpose = Protos.Transaction.Purpose.ASSURANCE_CONTRACT_PLEDGE; break;
|
||||
case ASSURANCE_CONTRACT_STUB: purpose = Protos.Transaction.Purpose.ASSURANCE_CONTRACT_STUB; break;
|
||||
case RAISE_FEE: purpose = Protos.Transaction.Purpose.RAISE_FEE; break;
|
||||
default:
|
||||
throw new RuntimeException("New tx purpose serialization not implemented.");
|
||||
}
|
||||
@@ -595,6 +596,7 @@ public class WalletProtobufSerializer {
|
||||
case ASSURANCE_CONTRACT_CLAIM: tx.setPurpose(Transaction.Purpose.ASSURANCE_CONTRACT_CLAIM); break;
|
||||
case ASSURANCE_CONTRACT_PLEDGE: tx.setPurpose(Transaction.Purpose.ASSURANCE_CONTRACT_PLEDGE); break;
|
||||
case ASSURANCE_CONTRACT_STUB: tx.setPurpose(Transaction.Purpose.ASSURANCE_CONTRACT_STUB); break;
|
||||
case RAISE_FEE: tx.setPurpose(Transaction.Purpose.RAISE_FEE); break;
|
||||
default: throw new RuntimeException("New purpose serialization not implemented");
|
||||
}
|
||||
} else {
|
||||
|
@@ -1,20 +1,27 @@
|
||||
package org.bitcoinj.utils;
|
||||
|
||||
import com.google.common.base.*;
|
||||
import org.bitcoinj.core.*;
|
||||
import org.slf4j.*;
|
||||
|
||||
import java.util.concurrent.*;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* A {@link java.util.concurrent.ThreadFactory} that propagates a {@link org.bitcoinj.core.Context} from the creating
|
||||
* thread into the new thread. This factory creates daemon threads.
|
||||
*/
|
||||
public class ContextPropagatingThreadFactory implements ThreadFactory {
|
||||
private static final Logger log = LoggerFactory.getLogger(ContextPropagatingThreadFactory.class);
|
||||
private final String name;
|
||||
private final int priority;
|
||||
|
||||
public ContextPropagatingThreadFactory(String name, int priority) {
|
||||
this.name = name;
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
public ContextPropagatingThreadFactory(String name) {
|
||||
this.name = checkNotNull(name);
|
||||
this(name, Thread.NORM_PRIORITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -23,11 +30,20 @@ public class ContextPropagatingThreadFactory implements ThreadFactory {
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Context.propagate(context);
|
||||
r.run();
|
||||
try {
|
||||
Context.propagate(context);
|
||||
r.run();
|
||||
} catch (Exception e) {
|
||||
log.error("Exception in thread", e);
|
||||
Throwables.propagate(e);
|
||||
}
|
||||
}
|
||||
}, name);
|
||||
thread.setPriority(priority);
|
||||
thread.setDaemon(true);
|
||||
Thread.UncaughtExceptionHandler handler = Threading.uncaughtExceptionHandler;
|
||||
if (handler != null)
|
||||
thread.setUncaughtExceptionHandler(handler);
|
||||
return thread;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -18,18 +18,15 @@
|
||||
package org.bitcoinj.wallet;
|
||||
|
||||
import org.bitcoinj.core.*;
|
||||
import org.bitcoinj.utils.Threading;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.bitcoinj.utils.*;
|
||||
import org.slf4j.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import javax.annotation.*;
|
||||
import java.io.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.*;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
|
||||
/**
|
||||
* A class that handles atomic and optionally delayed writing of the wallet file to disk. In future: backups too.
|
||||
@@ -67,15 +64,8 @@ public class WalletFiles {
|
||||
}
|
||||
|
||||
public WalletFiles(final Wallet wallet, File file, long delay, TimeUnit delayTimeUnit) {
|
||||
final ThreadFactoryBuilder builder = new ThreadFactoryBuilder()
|
||||
.setDaemon(true)
|
||||
.setNameFormat("Wallet autosave thread")
|
||||
.setPriority(Thread.MIN_PRIORITY); // Avoid competing with the GUI thread.
|
||||
Thread.UncaughtExceptionHandler handler = Threading.uncaughtExceptionHandler;
|
||||
if (handler != null)
|
||||
builder.setUncaughtExceptionHandler(handler);
|
||||
// An executor that starts up threads when needed and shuts them down later.
|
||||
this.executor = new ScheduledThreadPoolExecutor(1, builder.build());
|
||||
this.executor = new ScheduledThreadPoolExecutor(1, new ContextPropagatingThreadFactory("Wallet autosave thread", Thread.MIN_PRIORITY));
|
||||
this.executor.setKeepAliveTime(5, TimeUnit.SECONDS);
|
||||
this.executor.allowCoreThreadTimeOut(true);
|
||||
this.executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
|
||||
@@ -88,7 +78,6 @@ public class WalletFiles {
|
||||
|
||||
this.saver = new Callable<Void>() {
|
||||
@Override public Void call() throws Exception {
|
||||
Context.propagate(wallet.getContext());
|
||||
// Runs in an auto save thread.
|
||||
if (!savePending.getAndSet(false)) {
|
||||
// Some other scheduled request already beat us to it.
|
||||
|
Binary file not shown.
Binary file not shown.
@@ -19,6 +19,7 @@ package org.bitcoinj.store;
|
||||
|
||||
|
||||
import org.bitcoinj.core.*;
|
||||
import org.bitcoinj.core.Transaction.Purpose;
|
||||
import org.bitcoinj.core.TransactionConfidence.ConfidenceType;
|
||||
import org.bitcoinj.crypto.DeterministicKey;
|
||||
import org.bitcoinj.params.MainNetParams;
|
||||
@@ -133,6 +134,18 @@ public class WalletProtobufSerializerTest {
|
||||
assertEquals(t1p.getTransactionOutput(0).getValue(), v1.value);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void raiseFeeTx() throws Exception {
|
||||
// Check basic tx serialization.
|
||||
Coin v1 = COIN;
|
||||
Transaction t1 = createFakeTx(params, v1, myAddress);
|
||||
t1.setPurpose(Purpose.RAISE_FEE);
|
||||
myWallet.receivePending(t1, null);
|
||||
Wallet wallet1 = roundTrip(myWallet);
|
||||
Transaction t1copy = wallet1.getTransaction(t1.getHash());
|
||||
assertEquals(Purpose.RAISE_FEE, t1copy.getPurpose());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doubleSpend() throws Exception {
|
||||
// Check that we can serialize double spends correctly, as this is a slightly tricky case.
|
||||
|
@@ -271,6 +271,8 @@ message Transaction {
|
||||
ASSURANCE_CONTRACT_CLAIM = 3;
|
||||
ASSURANCE_CONTRACT_PLEDGE = 4;
|
||||
ASSURANCE_CONTRACT_STUB = 5;
|
||||
// Raise fee, e.g. child-pays-for-parent.
|
||||
RAISE_FEE = 6;
|
||||
// In future: de/refragmentation, privacy boosting/mixing, child-pays-for-parent fees, etc.
|
||||
}
|
||||
optional Purpose purpose = 10 [default = UNKNOWN];
|
||||
|
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>org.bitcoinj</groupId>
|
||||
<artifactId>bitcoinj-parent</artifactId>
|
||||
<version>0.13-SNAPSHOT</version>
|
||||
<version>0.13.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -6,11 +6,11 @@
|
||||
<parent>
|
||||
<groupId>org.bitcoinj</groupId>
|
||||
<artifactId>bitcoinj-parent</artifactId>
|
||||
<version>0.13-SNAPSHOT</version>
|
||||
<version>0.13.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>orchid</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.1.1</version>
|
||||
|
||||
<name>Orchid</name>
|
||||
<description>Tor library</description>
|
||||
|
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>org.bitcoinj</groupId>
|
||||
<artifactId>bitcoinj-parent</artifactId>
|
||||
<version>0.13-SNAPSHOT</version>
|
||||
<version>0.13.1</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
|
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>org.bitcoinj</groupId>
|
||||
<artifactId>bitcoinj-parent</artifactId>
|
||||
<version>0.13-SNAPSHOT</version>
|
||||
<version>0.13.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.bitcoinj</groupId>
|
||||
<artifactId>bitcoinj-parent</artifactId>
|
||||
<version>0.13-SNAPSHOT</version>
|
||||
<version>0.13.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>wallettemplate</artifactId>
|
||||
|
Reference in New Issue
Block a user