X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=Novacoin%2FCTransaction.cs;h=a061c70769885cb029fbfb4dc621ff56b232c64c;hb=624ac1021490395614a0cbee619c79860c22061a;hp=8402b1207698cd22cf3ccd1fb04cf54e5da18e86;hpb=b9cd39da5b7744f29c938ec53a99f7595e71c9ad;p=NovacoinLibrary.git diff --git a/Novacoin/CTransaction.cs b/Novacoin/CTransaction.cs index 8402b12..a061c70 100644 --- a/Novacoin/CTransaction.cs +++ b/Novacoin/CTransaction.cs @@ -21,6 +21,7 @@ using System.Text; using System.Collections.Generic; using System.IO; using System.Diagnostics.Contracts; +using System.Numerics; namespace Novacoin { @@ -48,6 +49,11 @@ namespace Novacoin public class CTransaction { /// + /// One cent = 10000 satoshis. + /// + public const ulong nCent = 10000; + + /// /// One coin = 1000000 satoshis. /// public const ulong nCoin = 1000000; @@ -138,15 +144,15 @@ namespace Novacoin return true; } - CTransaction txPrev = null; + TxOutItem txOutCursor = null; for (int i = 0; i < vin.Length; i++) { var outpoint = vin[i].prevout; - if (!CBlockStore.Instance.GetTransaction(outpoint.hash, ref txPrev)) + if (!CBlockStore.Instance.GetTxOutCursor(outpoint, ref txOutCursor)) return false; - if (!ScriptCode.VerifyScript(vin[i].scriptSig, txPrev.vout[outpoint.n].scriptPubKey, this, i, (int)scriptflag.SCRIPT_VERIFY_P2SH, 0)) + if (!ScriptCode.VerifyScript(vin[i].scriptSig, txOutCursor.scriptPubKey, this, i, (int)scriptflag.SCRIPT_VERIFY_P2SH, 0)) return false; } @@ -251,9 +257,9 @@ namespace Novacoin } if (nBlockTime == 0) { - nBlockTime = NetUtils.GetAdjustedTime(); + nBlockTime = NetInfo.GetAdjustedTime(); } - if (nLockTime < (nLockTime < NetUtils.nLockTimeThreshold ? nBlockHeight : nBlockTime)) + if (nLockTime < (nLockTime < NetInfo.nLockTimeThreshold ? nBlockHeight : nBlockTime)) { return true; } @@ -407,7 +413,7 @@ namespace Novacoin /// /// Amount of novacoins spent by this transaction. /// - public ulong ValueOut + public ulong nValueOut { get { @@ -474,5 +480,15 @@ namespace Novacoin } public static bool MoneyRange(ulong nValue) { return (nValue <= nMaxMoney); } + + internal uint GetP2SHSigOpCount(Dictionary inputs) + { + throw new NotImplementedException(); + } + + internal ulong GetValueIn(Dictionary inputs) + { + throw new NotImplementedException(); + } } }