mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 18:25:51 +00:00
Replace or remove remaining misuses of the term 'nanocoin'.
This commit is contained in:
parent
56ef72f36f
commit
39586bf515
@ -345,7 +345,7 @@ public class Transaction extends ChildMessage implements Serializable {
|
||||
* transactions sending coins to those keys to be in the wallet. This method will not attempt to download the
|
||||
* blocks containing the input transactions if the key is in the wallet but the transactions are not.
|
||||
*
|
||||
* @return sum in nanocoins.
|
||||
* @return sum of the inputs that are spending coins with keys in the wallet
|
||||
*/
|
||||
public Coin getValueSentFromMe(Wallet wallet) throws ScriptException {
|
||||
maybeParse();
|
||||
|
@ -160,7 +160,7 @@ public class TransactionOutput extends ChildMessage implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of this output in nanocoins. This is the amount of currency that the destination address
|
||||
* Returns the value of this output. This is the amount of currency that the destination address
|
||||
* receives.
|
||||
*/
|
||||
public Coin getValue() {
|
||||
@ -169,7 +169,7 @@ public class TransactionOutput extends ChildMessage implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of this output in nanocoins.
|
||||
* Sets the value of this output.
|
||||
*/
|
||||
public void setValue(Coin value) {
|
||||
checkNotNull(value);
|
||||
|
@ -2188,17 +2188,17 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
||||
* prevent this, but that should only occur once the transaction has been accepted by the network. This implies
|
||||
* you cannot have more than one outstanding sending tx at once.</p>
|
||||
*
|
||||
* <p>You MUST ensure that nanocoins is not smaller than {@link Transaction#MIN_NONDUST_OUTPUT} or the transaction
|
||||
* <p>You MUST ensure that the value is not smaller than {@link Transaction#MIN_NONDUST_OUTPUT} or the transaction
|
||||
* will almost certainly be rejected by the network as dust.</p>
|
||||
*
|
||||
* @param address The Bitcoin address to send the money to.
|
||||
* @param nanocoins How much currency to send, in nanocoins.
|
||||
* @param value How much currency to send.
|
||||
* @return either the created Transaction or null if there are insufficient coins.
|
||||
* coins as spent until commitTx is called on the result.
|
||||
* @throws InsufficientMoneyException if the request could not be completed due to not enough balance.
|
||||
*/
|
||||
public Transaction createSend(Address address, Coin nanocoins) throws InsufficientMoneyException {
|
||||
SendRequest req = SendRequest.to(address, nanocoins);
|
||||
public Transaction createSend(Address address, Coin value) throws InsufficientMoneyException {
|
||||
SendRequest req = SendRequest.to(address, value);
|
||||
if (params == UnitTestParams.get())
|
||||
req.shuffleOutputs = false;
|
||||
completeTx(req);
|
||||
@ -2243,7 +2243,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
||||
*
|
||||
* @param broadcaster a {@link TransactionBroadcaster} to use to send the transactions out.
|
||||
* @param to Which address to send coins to.
|
||||
* @param value How much value to send. You can use Utils.toNanoCoins() to calculate this.
|
||||
* @param value How much value to send.
|
||||
* @return An object containing the transaction that was created, and a future for the broadcast of it.
|
||||
* @throws InsufficientMoneyException if the request could not be completed due to not enough balance.
|
||||
*/
|
||||
|
@ -31,16 +31,16 @@ public class FakeTxBuilder {
|
||||
* Create a fake TX of sufficient realism to exercise the unit tests. Two outputs, one to us, one to somewhere
|
||||
* else to simulate change. There is one random input.
|
||||
*/
|
||||
public static Transaction createFakeTxWithChangeAddress(NetworkParameters params, Coin nanocoins, Address to, Address changeOutput) {
|
||||
public static Transaction createFakeTxWithChangeAddress(NetworkParameters params, Coin value, Address to, Address changeOutput) {
|
||||
Transaction t = new Transaction(params);
|
||||
TransactionOutput outputToMe = new TransactionOutput(params, t, nanocoins, to);
|
||||
TransactionOutput outputToMe = new TransactionOutput(params, t, value, to);
|
||||
t.addOutput(outputToMe);
|
||||
TransactionOutput change = new TransactionOutput(params, t, valueOf(1, 11), changeOutput);
|
||||
t.addOutput(change);
|
||||
// Make a previous tx simply to send us sufficient coins. This prev tx is not really valid but it doesn't
|
||||
// matter for our purposes.
|
||||
Transaction prevTx = new Transaction(params);
|
||||
TransactionOutput prevOut = new TransactionOutput(params, prevTx, nanocoins, to);
|
||||
TransactionOutput prevOut = new TransactionOutput(params, prevTx, value, to);
|
||||
prevTx.addOutput(prevOut);
|
||||
// Connect it.
|
||||
t.addInput(prevOut);
|
||||
@ -52,24 +52,24 @@ public class FakeTxBuilder {
|
||||
* Create a fake TX of sufficient realism to exercise the unit tests. Two outputs, one to us, one to somewhere
|
||||
* else to simulate change. There is one random input.
|
||||
*/
|
||||
public static Transaction createFakeTx(NetworkParameters params, Coin nanocoins, Address to) {
|
||||
return createFakeTxWithChangeAddress(params, nanocoins, to, new ECKey().toAddress(params));
|
||||
public static Transaction createFakeTx(NetworkParameters params, Coin value, Address to) {
|
||||
return createFakeTxWithChangeAddress(params, value, to, new ECKey().toAddress(params));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a fake TX of sufficient realism to exercise the unit tests. Two outputs, one to us, one to somewhere
|
||||
* else to simulate change. There is one random input.
|
||||
*/
|
||||
public static Transaction createFakeTx(NetworkParameters params, Coin nanocoins, ECKey to) {
|
||||
public static Transaction createFakeTx(NetworkParameters params, Coin value, ECKey to) {
|
||||
Transaction t = new Transaction(params);
|
||||
TransactionOutput outputToMe = new TransactionOutput(params, t, nanocoins, to);
|
||||
TransactionOutput outputToMe = new TransactionOutput(params, t, value, to);
|
||||
t.addOutput(outputToMe);
|
||||
TransactionOutput change = new TransactionOutput(params, t, valueOf(1, 11), new ECKey());
|
||||
t.addOutput(change);
|
||||
// Make a previous tx simply to send us sufficient coins. This prev tx is not really valid but it doesn't
|
||||
// matter for our purposes.
|
||||
Transaction prevTx = new Transaction(params);
|
||||
TransactionOutput prevOut = new TransactionOutput(params, prevTx, nanocoins, to);
|
||||
TransactionOutput prevOut = new TransactionOutput(params, prevTx, value, to);
|
||||
prevTx.addOutput(prevOut);
|
||||
// Connect it.
|
||||
t.addInput(prevOut);
|
||||
@ -80,24 +80,24 @@ public class FakeTxBuilder {
|
||||
/**
|
||||
* Transaction[0] is a feeder transaction, supplying BTC to Transaction[1]
|
||||
*/
|
||||
public static Transaction[] createFakeTx(NetworkParameters params, Coin nanocoins,
|
||||
public static Transaction[] createFakeTx(NetworkParameters params, Coin value,
|
||||
Address to, Address from) {
|
||||
// Create fake TXes of sufficient realism to exercise the unit tests. This transaction send BTC from the
|
||||
// from address, to the to address with to one to somewhere else to simulate change.
|
||||
Transaction t = new Transaction(params);
|
||||
TransactionOutput outputToMe = new TransactionOutput(params, t, nanocoins, to);
|
||||
TransactionOutput outputToMe = new TransactionOutput(params, t, value, to);
|
||||
t.addOutput(outputToMe);
|
||||
TransactionOutput change = new TransactionOutput(params, t, valueOf(1, 11), new ECKey().toAddress(params));
|
||||
t.addOutput(change);
|
||||
// Make a feeder tx that sends to the from address specified. This feeder tx is not really valid but it doesn't
|
||||
// matter for our purposes.
|
||||
Transaction feederTx = new Transaction(params);
|
||||
TransactionOutput feederOut = new TransactionOutput(params, feederTx, nanocoins, from);
|
||||
TransactionOutput feederOut = new TransactionOutput(params, feederTx, value, from);
|
||||
feederTx.addOutput(feederOut);
|
||||
|
||||
// make a previous tx that sends from the feeder to the from address
|
||||
Transaction prevTx = new Transaction(params);
|
||||
TransactionOutput prevOut = new TransactionOutput(params, prevTx, nanocoins, to);
|
||||
TransactionOutput prevOut = new TransactionOutput(params, prevTx, value, to);
|
||||
prevTx.addOutput(prevOut);
|
||||
|
||||
// Connect up the txes
|
||||
|
@ -322,7 +322,7 @@ public class BitcoinURI {
|
||||
* Simple Bitcoin URI builder using known good fields.
|
||||
*
|
||||
* @param address The Bitcoin address
|
||||
* @param amount The amount in nanocoins (decimal)
|
||||
* @param amount The amount
|
||||
* @param label A label
|
||||
* @param message A message
|
||||
* @return A String containing the Bitcoin URI
|
||||
|
@ -33,7 +33,7 @@ public class CoinTest {
|
||||
assertEquals(COIN.add(CENT), parseCoin("1.01"));
|
||||
try {
|
||||
parseCoin("2E-20");
|
||||
org.junit.Assert.fail("should not have accepted fractional nanocoins");
|
||||
org.junit.Assert.fail("should not have accepted fractional satoshis");
|
||||
} catch (ArithmeticException e) {
|
||||
}
|
||||
|
||||
|
@ -1572,7 +1572,7 @@ public class WalletTest extends TestWithWallet {
|
||||
wallet.completeTx(request7);
|
||||
assertEquals(Transaction.REFERENCE_DEFAULT_MIN_TX_FEE, request7.fee);
|
||||
Transaction spend7 = request7.tx;
|
||||
// If change is 0.1-nanocoin and we already have a 0.1-nanocoin output, fee should be reference fee
|
||||
// If change is 0.1-satoshi and we already have a 0.1-satoshi output, fee should be reference fee
|
||||
assertEquals(3, spend7.getOutputs().size());
|
||||
// We optimize for priority, so the output selected should be the largest one.
|
||||
assertEquals(spend7.getOutput(0).getValue().add(spend7.getOutput(1).getValue()).add(spend7.getOutput(2).getValue()),
|
||||
|
@ -45,13 +45,13 @@ public class PaymentSessionTest {
|
||||
private ECKey serverKey;
|
||||
private Transaction tx;
|
||||
private TransactionOutput outputToMe;
|
||||
private Coin nanoCoins = COIN;
|
||||
private Coin coin = COIN;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
serverKey = new ECKey();
|
||||
tx = new Transaction(params);
|
||||
outputToMe = new TransactionOutput(params, tx, nanoCoins, serverKey);
|
||||
outputToMe = new TransactionOutput(params, tx, coin, serverKey);
|
||||
tx.addOutput(outputToMe);
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ public class PaymentSessionTest {
|
||||
// Create a PaymentRequest and make sure the correct values are parsed by the PaymentSession.
|
||||
MockPaymentSession paymentSession = new MockPaymentSession(newSimplePaymentRequest("test"));
|
||||
assertEquals(paymentRequestMemo, paymentSession.getMemo());
|
||||
assertEquals(nanoCoins, paymentSession.getValue());
|
||||
assertEquals(coin, paymentSession.getValue());
|
||||
assertEquals(simplePaymentUrl, paymentSession.getPaymentUrl());
|
||||
assertTrue(new Date(time * 1000L).equals(paymentSession.getDate()));
|
||||
assertTrue(paymentSession.getSendRequest().tx.equals(tx));
|
||||
@ -79,8 +79,8 @@ public class PaymentSessionTest {
|
||||
assertEquals(paymentMemo, payment.getMemo());
|
||||
assertEquals(merchantData, payment.getMerchantData());
|
||||
assertEquals(1, payment.getRefundToCount());
|
||||
assertEquals(nanoCoins.value, payment.getRefundTo(0).getAmount());
|
||||
TransactionOutput refundOutput = new TransactionOutput(params, null, nanoCoins, refundAddr);
|
||||
assertEquals(coin.value, payment.getRefundTo(0).getAmount());
|
||||
TransactionOutput refundOutput = new TransactionOutput(params, null, coin, refundAddr);
|
||||
ByteString refundScript = ByteString.copyFrom(refundOutput.getScriptBytes());
|
||||
assertTrue(refundScript.equals(payment.getRefundTo(0).getScript()));
|
||||
}
|
||||
@ -149,7 +149,7 @@ public class PaymentSessionTest {
|
||||
|
||||
private Protos.PaymentRequest newSimplePaymentRequest(String netID) {
|
||||
Protos.Output.Builder outputBuilder = Protos.Output.newBuilder()
|
||||
.setAmount(nanoCoins.value)
|
||||
.setAmount(coin.value)
|
||||
.setScript(ByteString.copyFrom(outputToMe.getScriptBytes()));
|
||||
Protos.PaymentDetails paymentDetails = Protos.PaymentDetails.newBuilder()
|
||||
.setNetwork(netID)
|
||||
@ -168,7 +168,7 @@ public class PaymentSessionTest {
|
||||
|
||||
private Protos.PaymentRequest newExpiredPaymentRequest() {
|
||||
Protos.Output.Builder outputBuilder = Protos.Output.newBuilder()
|
||||
.setAmount(nanoCoins.value)
|
||||
.setAmount(coin.value)
|
||||
.setScript(ByteString.copyFrom(outputToMe.getScriptBytes()));
|
||||
Protos.PaymentDetails paymentDetails = Protos.PaymentDetails.newBuilder()
|
||||
.setNetwork("test")
|
||||
|
Loading…
x
Reference in New Issue
Block a user