2020import static org .tron .utils .Utils .getRandom ;
2121
2222public class TransactionUtils {
23- private static final Logger logger = LoggerFactory .getLogger ("transaction " );
24- private final static int subsidy = 10 ; // Mining reward
23+ private static final Logger LOGGER = LoggerFactory .getLogger ("Transaction " );
24+ private final static int RESERVE_BALANCE = 10 ;
2525
2626 public static Transaction newTransaction (Wallet wallet , String to , long amount , UTXOSet utxoSet ) {
2727 ArrayList <TXInput > txInputs = new ArrayList <>();
@@ -32,7 +32,7 @@ public static Transaction newTransaction(Wallet wallet, String to, long amount,
3232 SpendableOutputs spendableOutputs = utxoSet .findSpendableOutputs (pubKeyHash , amount );
3333
3434 if (spendableOutputs .getAmount () < amount ) {
35- logger .error ("Not enough funds" );
35+ LOGGER .error ("Not enough funds" );
3636 return null ;
3737 }
3838
@@ -87,7 +87,7 @@ public static Transaction newCoinbaseTransaction(String to, String data) {
8787
8888 TXInput txi = TXInputUtils .newTXInput (new byte []{}, -1 , new byte []{},
8989 ByteArray .fromHexString (data ));
90- TXOutput txo = TXOutputUtils .newTXOutput (subsidy , to );
90+ TXOutput txo = TXOutputUtils .newTXOutput (RESERVE_BALANCE , to );
9191
9292 Transaction .Builder coinbaseTransaction = Transaction .newBuilder ()
9393 .addVin (txi )
@@ -193,7 +193,7 @@ public static Transaction sign(Transaction transaction, ECKey myKey,
193193 for (TXInput vin : transaction .getVinList ()) {
194194 if (prevTXs .get (ByteArray .toHexString (vin .getTxID ().toByteArray ()
195195 )).getId ().toByteArray ().length == 0 ) {
196- logger .error ("ERROR: Previous transaction is not correct" );
196+ LOGGER .error ("ERROR: Previous transaction is not correct" );
197197 return null ;
198198 }
199199 }
@@ -237,7 +237,7 @@ public static boolean verify(ECKey myKey, Transaction transaction,
237237 for (TXInput vin : transaction .getVinList ()) {
238238 if (prevTXs .get (ByteArray .toHexString (vin .getTxID ().toByteArray ()
239239 )).getId ().toByteArray ().length == 0 ) {
240- logger .error ("ERROR: Previous transaction is not correct" );
240+ LOGGER .error ("ERROR: Previous transaction is not correct" );
241241 }
242242 }
243243
0 commit comments