3
0
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:
Andreas Schildbach 2014-05-30 17:14:52 +02:00
parent 56ef72f36f
commit 39586bf515
8 changed files with 32 additions and 32 deletions

View File

@ -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 * 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. * 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 { public Coin getValueSentFromMe(Wallet wallet) throws ScriptException {
maybeParse(); maybeParse();

View File

@ -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. * receives.
*/ */
public Coin getValue() { 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) { public void setValue(Coin value) {
checkNotNull(value); checkNotNull(value);

View File

@ -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 * 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> * 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> * will almost certainly be rejected by the network as dust.</p>
* *
* @param address The Bitcoin address to send the money to. * @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. * @return either the created Transaction or null if there are insufficient coins.
* coins as spent until commitTx is called on the result. * coins as spent until commitTx is called on the result.
* @throws InsufficientMoneyException if the request could not be completed due to not enough balance. * @throws InsufficientMoneyException if the request could not be completed due to not enough balance.
*/ */
public Transaction createSend(Address address, Coin nanocoins) throws InsufficientMoneyException { public Transaction createSend(Address address, Coin value) throws InsufficientMoneyException {
SendRequest req = SendRequest.to(address, nanocoins); SendRequest req = SendRequest.to(address, value);
if (params == UnitTestParams.get()) if (params == UnitTestParams.get())
req.shuffleOutputs = false; req.shuffleOutputs = false;
completeTx(req); 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 broadcaster a {@link TransactionBroadcaster} to use to send the transactions out.
* @param to Which address to send coins to. * @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. * @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. * @throws InsufficientMoneyException if the request could not be completed due to not enough balance.
*/ */

View File

@ -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 * 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. * 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); Transaction t = new Transaction(params);
TransactionOutput outputToMe = new TransactionOutput(params, t, nanocoins, to); TransactionOutput outputToMe = new TransactionOutput(params, t, value, to);
t.addOutput(outputToMe); t.addOutput(outputToMe);
TransactionOutput change = new TransactionOutput(params, t, valueOf(1, 11), changeOutput); TransactionOutput change = new TransactionOutput(params, t, valueOf(1, 11), changeOutput);
t.addOutput(change); t.addOutput(change);
// Make a previous tx simply to send us sufficient coins. This prev tx is not really valid but it doesn't // 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. // matter for our purposes.
Transaction prevTx = new Transaction(params); Transaction prevTx = new Transaction(params);
TransactionOutput prevOut = new TransactionOutput(params, prevTx, nanocoins, to); TransactionOutput prevOut = new TransactionOutput(params, prevTx, value, to);
prevTx.addOutput(prevOut); prevTx.addOutput(prevOut);
// Connect it. // Connect it.
t.addInput(prevOut); 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 * 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. * else to simulate change. There is one random input.
*/ */
public static Transaction createFakeTx(NetworkParameters params, Coin nanocoins, Address to) { public static Transaction createFakeTx(NetworkParameters params, Coin value, Address to) {
return createFakeTxWithChangeAddress(params, nanocoins, to, new ECKey().toAddress(params)); 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 * 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. * 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); Transaction t = new Transaction(params);
TransactionOutput outputToMe = new TransactionOutput(params, t, nanocoins, to); TransactionOutput outputToMe = new TransactionOutput(params, t, value, to);
t.addOutput(outputToMe); t.addOutput(outputToMe);
TransactionOutput change = new TransactionOutput(params, t, valueOf(1, 11), new ECKey()); TransactionOutput change = new TransactionOutput(params, t, valueOf(1, 11), new ECKey());
t.addOutput(change); t.addOutput(change);
// Make a previous tx simply to send us sufficient coins. This prev tx is not really valid but it doesn't // 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. // matter for our purposes.
Transaction prevTx = new Transaction(params); Transaction prevTx = new Transaction(params);
TransactionOutput prevOut = new TransactionOutput(params, prevTx, nanocoins, to); TransactionOutput prevOut = new TransactionOutput(params, prevTx, value, to);
prevTx.addOutput(prevOut); prevTx.addOutput(prevOut);
// Connect it. // Connect it.
t.addInput(prevOut); t.addInput(prevOut);
@ -80,24 +80,24 @@ public class FakeTxBuilder {
/** /**
* Transaction[0] is a feeder transaction, supplying BTC to Transaction[1] * 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) { Address to, Address from) {
// Create fake TXes of sufficient realism to exercise the unit tests. This transaction send BTC from the // 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. // from address, to the to address with to one to somewhere else to simulate change.
Transaction t = new Transaction(params); Transaction t = new Transaction(params);
TransactionOutput outputToMe = new TransactionOutput(params, t, nanocoins, to); TransactionOutput outputToMe = new TransactionOutput(params, t, value, to);
t.addOutput(outputToMe); t.addOutput(outputToMe);
TransactionOutput change = new TransactionOutput(params, t, valueOf(1, 11), new ECKey().toAddress(params)); TransactionOutput change = new TransactionOutput(params, t, valueOf(1, 11), new ECKey().toAddress(params));
t.addOutput(change); 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 // 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. // matter for our purposes.
Transaction feederTx = new Transaction(params); Transaction feederTx = new Transaction(params);
TransactionOutput feederOut = new TransactionOutput(params, feederTx, nanocoins, from); TransactionOutput feederOut = new TransactionOutput(params, feederTx, value, from);
feederTx.addOutput(feederOut); feederTx.addOutput(feederOut);
// make a previous tx that sends from the feeder to the from address // make a previous tx that sends from the feeder to the from address
Transaction prevTx = new Transaction(params); Transaction prevTx = new Transaction(params);
TransactionOutput prevOut = new TransactionOutput(params, prevTx, nanocoins, to); TransactionOutput prevOut = new TransactionOutput(params, prevTx, value, to);
prevTx.addOutput(prevOut); prevTx.addOutput(prevOut);
// Connect up the txes // Connect up the txes

View File

@ -322,7 +322,7 @@ public class BitcoinURI {
* Simple Bitcoin URI builder using known good fields. * Simple Bitcoin URI builder using known good fields.
* *
* @param address The Bitcoin address * @param address The Bitcoin address
* @param amount The amount in nanocoins (decimal) * @param amount The amount
* @param label A label * @param label A label
* @param message A message * @param message A message
* @return A String containing the Bitcoin URI * @return A String containing the Bitcoin URI

View File

@ -33,7 +33,7 @@ public class CoinTest {
assertEquals(COIN.add(CENT), parseCoin("1.01")); assertEquals(COIN.add(CENT), parseCoin("1.01"));
try { try {
parseCoin("2E-20"); 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) { } catch (ArithmeticException e) {
} }

View File

@ -1572,7 +1572,7 @@ public class WalletTest extends TestWithWallet {
wallet.completeTx(request7); wallet.completeTx(request7);
assertEquals(Transaction.REFERENCE_DEFAULT_MIN_TX_FEE, request7.fee); assertEquals(Transaction.REFERENCE_DEFAULT_MIN_TX_FEE, request7.fee);
Transaction spend7 = request7.tx; 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()); assertEquals(3, spend7.getOutputs().size());
// We optimize for priority, so the output selected should be the largest one. // 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()), assertEquals(spend7.getOutput(0).getValue().add(spend7.getOutput(1).getValue()).add(spend7.getOutput(2).getValue()),

View File

@ -45,13 +45,13 @@ public class PaymentSessionTest {
private ECKey serverKey; private ECKey serverKey;
private Transaction tx; private Transaction tx;
private TransactionOutput outputToMe; private TransactionOutput outputToMe;
private Coin nanoCoins = COIN; private Coin coin = COIN;
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
serverKey = new ECKey(); serverKey = new ECKey();
tx = new Transaction(params); tx = new Transaction(params);
outputToMe = new TransactionOutput(params, tx, nanoCoins, serverKey); outputToMe = new TransactionOutput(params, tx, coin, serverKey);
tx.addOutput(outputToMe); tx.addOutput(outputToMe);
} }
@ -60,7 +60,7 @@ public class PaymentSessionTest {
// Create a PaymentRequest and make sure the correct values are parsed by the PaymentSession. // Create a PaymentRequest and make sure the correct values are parsed by the PaymentSession.
MockPaymentSession paymentSession = new MockPaymentSession(newSimplePaymentRequest("test")); MockPaymentSession paymentSession = new MockPaymentSession(newSimplePaymentRequest("test"));
assertEquals(paymentRequestMemo, paymentSession.getMemo()); assertEquals(paymentRequestMemo, paymentSession.getMemo());
assertEquals(nanoCoins, paymentSession.getValue()); assertEquals(coin, paymentSession.getValue());
assertEquals(simplePaymentUrl, paymentSession.getPaymentUrl()); assertEquals(simplePaymentUrl, paymentSession.getPaymentUrl());
assertTrue(new Date(time * 1000L).equals(paymentSession.getDate())); assertTrue(new Date(time * 1000L).equals(paymentSession.getDate()));
assertTrue(paymentSession.getSendRequest().tx.equals(tx)); assertTrue(paymentSession.getSendRequest().tx.equals(tx));
@ -79,8 +79,8 @@ public class PaymentSessionTest {
assertEquals(paymentMemo, payment.getMemo()); assertEquals(paymentMemo, payment.getMemo());
assertEquals(merchantData, payment.getMerchantData()); assertEquals(merchantData, payment.getMerchantData());
assertEquals(1, payment.getRefundToCount()); assertEquals(1, payment.getRefundToCount());
assertEquals(nanoCoins.value, payment.getRefundTo(0).getAmount()); assertEquals(coin.value, payment.getRefundTo(0).getAmount());
TransactionOutput refundOutput = new TransactionOutput(params, null, nanoCoins, refundAddr); TransactionOutput refundOutput = new TransactionOutput(params, null, coin, refundAddr);
ByteString refundScript = ByteString.copyFrom(refundOutput.getScriptBytes()); ByteString refundScript = ByteString.copyFrom(refundOutput.getScriptBytes());
assertTrue(refundScript.equals(payment.getRefundTo(0).getScript())); assertTrue(refundScript.equals(payment.getRefundTo(0).getScript()));
} }
@ -149,7 +149,7 @@ public class PaymentSessionTest {
private Protos.PaymentRequest newSimplePaymentRequest(String netID) { private Protos.PaymentRequest newSimplePaymentRequest(String netID) {
Protos.Output.Builder outputBuilder = Protos.Output.newBuilder() Protos.Output.Builder outputBuilder = Protos.Output.newBuilder()
.setAmount(nanoCoins.value) .setAmount(coin.value)
.setScript(ByteString.copyFrom(outputToMe.getScriptBytes())); .setScript(ByteString.copyFrom(outputToMe.getScriptBytes()));
Protos.PaymentDetails paymentDetails = Protos.PaymentDetails.newBuilder() Protos.PaymentDetails paymentDetails = Protos.PaymentDetails.newBuilder()
.setNetwork(netID) .setNetwork(netID)
@ -168,7 +168,7 @@ public class PaymentSessionTest {
private Protos.PaymentRequest newExpiredPaymentRequest() { private Protos.PaymentRequest newExpiredPaymentRequest() {
Protos.Output.Builder outputBuilder = Protos.Output.newBuilder() Protos.Output.Builder outputBuilder = Protos.Output.newBuilder()
.setAmount(nanoCoins.value) .setAmount(coin.value)
.setScript(ByteString.copyFrom(outputToMe.getScriptBytes())); .setScript(ByteString.copyFrom(outputToMe.getScriptBytes()));
Protos.PaymentDetails paymentDetails = Protos.PaymentDetails.newBuilder() Protos.PaymentDetails paymentDetails = Protos.PaymentDetails.newBuilder()
.setNetwork("test") .setNetwork("test")