aboutsummaryrefslogtreecommitdiff
path: root/main.h
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-09-23 16:01:44 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-09-23 16:01:44 +0000
commit9b8eb4d6907502e9b1e74b62a850a11655d50ab5 (patch)
tree644eff72e48ca77b1dec43b42af1a4eb98d68f72 /main.h
parent172f006020965ae8763a0610845c051ed1e3b522 (diff)
downloadbitcoin-9b8eb4d6907502e9b1e74b62a850a11655d50ab5.tar.xz
changed free transactions per block threshold
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@157 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'main.h')
-rw-r--r--main.h33
1 files changed, 20 insertions, 13 deletions
diff --git a/main.h b/main.h
index 0082d5d065..95e946a898 100644
--- a/main.h
+++ b/main.h
@@ -565,15 +565,16 @@ public:
{
// Base fee is 1 cent per kilobyte
unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK);
+ unsigned int nNewBlockSize = nBlockSize + nBytes;
int64 nMinFee = (1 + (int64)nBytes / 1000) * CENT;
- // Transactions under 60K are free as long as block size is under 80K
- // (about 27,000bc if made of 50bc inputs)
- if (nBytes < 60000 && nBlockSize < 80000)
+ // Transactions under 25K are free as long as block size is under 40K
+ // (about 11,000bc if made of 50bc inputs)
+ if (nBytes < 25000 && nNewBlockSize < 40000)
nMinFee = 0;
- // Transactions under 3K are free as long as block size is under 200K
- if (nBytes < 3000 && nBlockSize < 200000)
+ // Transactions under 3K are free as long as block size is under 50K
+ if (nBytes < 3000 && nNewBlockSize < 50000)
nMinFee = 0;
// To limit dust spam, require a 0.01 fee if any output is less than 0.01
@@ -583,11 +584,15 @@ public:
nMinFee = CENT;
// Raise the price as the block approaches full
- if (MAX_BLOCK_SIZE/2 <= nBlockSize && nBlockSize < MAX_BLOCK_SIZE)
- nMinFee *= MAX_BLOCK_SIZE / (MAX_BLOCK_SIZE - nBlockSize);
+ if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2)
+ {
+ if (nNewBlockSize >= MAX_BLOCK_SIZE_GEN)
+ return MAX_MONEY;
+ nMinFee *= MAX_BLOCK_SIZE_GEN / (MAX_BLOCK_SIZE_GEN - nNewBlockSize);
+ }
+
if (!MoneyRange(nMinFee))
nMinFee = MAX_MONEY;
-
return nMinFee;
}
@@ -1186,9 +1191,11 @@ public:
CBigNum GetBlockWork() const
{
- if (CBigNum().SetCompact(nBits) <= 0)
+ CBigNum bnTarget;
+ bnTarget.SetCompact(nBits);
+ if (bnTarget <= 0)
return 0;
- return (CBigNum(1)<<256) / (CBigNum().SetCompact(nBits)+1);
+ return (CBigNum(1)<<256) / (bnTarget+1);
}
bool IsInMainChain() const
@@ -1470,10 +1477,10 @@ public:
//// todo: add something to note what created it (user, getnewaddress, change)
//// maybe should have a map<string, string> property map
- CWalletKey(int64 nTimeExpiresIn=0)
+ CWalletKey(int64 nExpires=0)
{
- nTimeCreated = (nTimeExpiresIn ? GetTime() : 0);
- nTimeExpires = nTimeExpiresIn;
+ nTimeCreated = (nExpires ? GetTime() : 0);
+ nTimeExpires = nExpires;
}
IMPLEMENT_SERIALIZE