Add and use new owner_reserve.

This commit is contained in:
Arthur Britto
2012-12-13 15:45:49 -08:00
parent 092fe4389e
commit 72d8811ad3
5 changed files with 24 additions and 11 deletions

View File

@@ -17,7 +17,8 @@
#define SECTION_FEE_NICKNAME_CREATE "fee_nickname_create"
#define SECTION_FEE_OFFER "fee_offer"
#define SECTION_FEE_OPERATION "fee_operation"
#define SECTION_FEE_RESERVE "fee_reserve"
#define SECTION_FEE_ACCOUNT_RESERVE "fee_account_reserve"
#define SECTION_FEE_OWNER_RESERVE "fee_owner_reserve"
#define SECTION_LEDGER_HISTORY "ledger_history"
#define SECTION_IPS "ips"
#define SECTION_NETWORK_QUORUM "network_quorum"
@@ -48,7 +49,8 @@
// Fees are in XRP.
#define DEFAULT_FEE_DEFAULT 10
#define DEFAULT_FEE_RESERVE 200*SYSTEM_CURRENCY_PARTS
#define DEFAULT_FEE_ACCOUNT_RESERVE 200*SYSTEM_CURRENCY_PARTS
#define DEFAULT_FEE_OWNER_RESERVE 50*SYSTEM_CURRENCY_PARTS
#define DEFAULT_FEE_NICKNAME_CREATE 1000
#define DEFAULT_FEE_OFFER DEFAULT_FEE_DEFAULT
#define DEFAULT_FEE_OPERATION 1
@@ -162,7 +164,8 @@ void Config::setup(const std::string& strConf, bool bQuiet)
NETWORK_QUORUM = 0; // Don't need to see other nodes
VALIDATION_QUORUM = 1; // Only need one node to vouch
FEE_RESERVE = DEFAULT_FEE_RESERVE;
FEE_ACCOUNT_RESERVE = DEFAULT_FEE_ACCOUNT_RESERVE;
FEE_OWNER_RESERVE = DEFAULT_FEE_OWNER_RESERVE;
FEE_NICKNAME_CREATE = DEFAULT_FEE_NICKNAME_CREATE;
FEE_OFFER = DEFAULT_FEE_OFFER;
FEE_DEFAULT = DEFAULT_FEE_DEFAULT;
@@ -297,8 +300,11 @@ void Config::load()
if (sectionSingleB(secConfig, SECTION_VALIDATION_QUORUM, strTemp))
VALIDATION_QUORUM = std::max(0, boost::lexical_cast<int>(strTemp));
if (sectionSingleB(secConfig, SECTION_FEE_RESERVE, strTemp))
FEE_RESERVE = boost::lexical_cast<uint64>(strTemp);
if (sectionSingleB(secConfig, SECTION_FEE_ACCOUNT_RESERVE, strTemp))
FEE_ACCOUNT_RESERVE = boost::lexical_cast<uint64>(strTemp);
if (sectionSingleB(secConfig, SECTION_FEE_OWNER_RESERVE, strTemp))
FEE_OWNER_RESERVE = boost::lexical_cast<uint64>(strTemp);
if (sectionSingleB(secConfig, SECTION_FEE_NICKNAME_CREATE, strTemp))
FEE_NICKNAME_CREATE = boost::lexical_cast<int>(strTemp);

View File

@@ -108,7 +108,8 @@ public:
// Fee schedule
uint64 FEE_DEFAULT; // Default fee.
uint64 FEE_RESERVE; // Amount of XRP not allowed to send.
uint64 FEE_ACCOUNT_RESERVE; // Amount of XRP not allowed to send.
uint64 FEE_OWNER_RESERVE; // Amount of XRP not allowed to send per owner entry.
uint64 FEE_NICKNAME_CREATE; // Fee to create a nickname.
uint64 FEE_OFFER; // Rate per day.
int FEE_CONTRACT_OPERATION; // fee for each contract operation

View File

@@ -28,6 +28,7 @@ static bool LEFInit()
<< SOElement(sfMessageKey, SOE_OPTIONAL)
<< SOElement(sfTransferRate, SOE_OPTIONAL)
<< SOElement(sfDomain, SOE_OPTIONAL)
<< SOElement(sfOwnerCount, SOE_OPTIONAL)
;
DECLARE_LEF(Contract, ltCONTRACT)

View File

@@ -83,7 +83,7 @@ TER PaymentTransactor::doApply()
return temCREATEXRP;
}
else if (isSetBit(mParams, tapOPEN_LEDGER) // Ledger is not final, we can vote.
&& saDstAmount.getNValue() < theConfig.FEE_RESERVE) // Reserve is not scaled by fee.
&& saDstAmount.getNValue() < theConfig.FEE_ACCOUNT_RESERVE) // Reserve is not scaled by fee.
{
Log(lsINFO) << "doPayment: Delay transaction: Destination account does not exist insufficent payment to create account.";
@@ -136,11 +136,15 @@ TER PaymentTransactor::doApply()
{
// Direct XRP payment.
STAmount saSrcXRPBalance = mTxnAccount->getFieldAmount(sfBalance);
const STAmount saSrcXRPBalance = mTxnAccount->getFieldAmount(sfBalance);
const uint32 uOwnerCount = mTxn.getFieldU32(sfOwnerCount);
const uint64 uReserve = theConfig.FEE_ACCOUNT_RESERVE+uOwnerCount*theConfig.FEE_OWNER_RESERVE;
if (saSrcXRPBalance < saDstAmount + theConfig.FEE_RESERVE) // Reserve is not scaled by fee.
// Make sure have enough reserve to send.
if (isSetBit(mParams, tapOPEN_LEDGER) // Ledger is not final, we can vote.
&& saSrcXRPBalance < saDstAmount + uReserve) // Reserve is not scaled by fee.
{
// Transaction might succeed, if applied in a different order.
// Vote no. However, transaction might succeed, if applied in a different order.
Log(lsINFO) << "doPayment: Delay transaction: Insufficient funds.";
terResult = terUNFUNDED;

View File

@@ -43,6 +43,7 @@
FIELD(Expiration, UINT32, 10)
FIELD(TransferRate, UINT32, 11)
FIELD(WalletSize, UINT32, 12)
FIELD(OwnerCount, UINT32, 13) // Reorder on ledger reset.
// 32-bit integers (uncommon)
FIELD(HighQualityIn, UINT32, 16)