Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework tx creation + implement Class C & missing transactions #13

Merged
merged 56 commits into from
May 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
a036633
ClassC-0.0.10 mastercore
zathras-crypto Mar 25, 2015
7f49f5c
ClassC-0.0.10 mastercore_rpc
zathras-crypto Mar 25, 2015
c2d23ff
ClassC-0.0.10 mastercore_tx
zathras-crypto Mar 25, 2015
f148cd7
ClassC-0.0.10 fix IsDust for unspendable outputs
zathras-crypto Mar 25, 2015
4ae489b
Cleanup - remove debugging include
zathras-crypto Mar 25, 2015
e56def0
cleanup - disable extra parser debugging
zathras-crypto Mar 25, 2015
3e2e6d4
Rename to MIN_PAYLOAD_SIZE and correct value
zathras-crypto Mar 26, 2015
6407370
Fix maximum OP_RETURN packet size
zathras-crypto Mar 27, 2015
cbe5920
Make classAgnostic_Send return an error if the payload is too big
zathras-crypto Mar 29, 2015
90a2d55
[TX CREATION SIMPLIFICATION] - OmniCore Encoding
zathras-crypto Mar 30, 2015
070a9f2
[TX CREATION SIMPLIFICATION] - OmniCore utils
zathras-crypto Mar 30, 2015
c4612f2
[TX CREATION SIMPLIFICATION] - Mastercore modifications
zathras-crypto Mar 30, 2015
0cbd9f1
[TX CREATION SIMPLIFICATION] - Makefile update
zathras-crypto Mar 30, 2015
28f8d66
[FIX] - Ensure reference output is added last
zathras-crypto Mar 30, 2015
fd881a3
Switch to a 2 byte marker
zathras-crypto Apr 1, 2015
58a21f2
Fix: strip 2 instead of 4 bytes from OP_RETURN output for marker
zathras-crypto Apr 2, 2015
a0dfa0b
[CONSOLIDATE] mastercore_rpc.cpp/h changes
zathras-crypto Apr 7, 2015
daf5715
[CONSOLIDATE] mastercore.cpp/h changes
zathras-crypto Apr 7, 2015
5bb365f
[CONSOLIDATE] rpcserver.cpp/h changes
zathras-crypto Apr 7, 2015
369d495
[CONSOLIDATE] omnicore_createpayload.cpp/h
zathras-crypto Apr 7, 2015
50c5098
[CONSOLIDATE] omnicore_rpctx.cpp/h
zathras-crypto Apr 7, 2015
dedc077
[CONSOLIDATE] omnicore_encoding.cpp/h changes
zathras-crypto Apr 7, 2015
0298fd1
[CONSOLIDATE] rpcclient.cpp/h changes
zathras-crypto Apr 7, 2015
aeb2915
[CONSOLIDATE] Makefile changes
zathras-crypto Apr 7, 2015
9f3aa31
Fix backwards version/type
zathras-crypto Apr 7, 2015
98ba242
Fix merge conflicts
zathras-crypto Apr 7, 2015
a4d8540
Fix class selection on creation - credit @dexX7
zathras-crypto Apr 7, 2015
9301eb9
Fix class selection size check
dexX7 Apr 8, 2015
52d7437
Merge pull request #60 from dexX7/oc-0.10-pr-13-should-use-class-c
zathras-crypto Apr 8, 2015
07100c5
Resolve merge conflicts after meta DEx RPC enabler PR
dexX7 Apr 9, 2015
2fb849c
Merge pull request #61 from dexX7/oc-0.10-pr-13-resolve-mdex-merge-co…
zathras-crypto Apr 9, 2015
c80abd0
Utils: refine includes and dependencies, improve documentation
dexX7 Apr 10, 2015
e911488
Utils: test generation of obfuscated hashes via unit tests
dexX7 Apr 10, 2015
cd75837
Script: improve readability and documentation of GetScriptPushes
dexX7 Apr 10, 2015
3d8ad43
Script: rename and move getOutputType to GetOutputType
dexX7 Apr 10, 2015
ecc50ec
Script: test script extraction via unit tests
dexX7 Apr 10, 2015
a67ca3c
Script: rename and move GetDustLimit to GetDustThreshold
dexX7 Apr 10, 2015
8aa1c10
Script: test getting dust threshold via unit tests
dexX7 Apr 10, 2015
56fde5c
mastercore.cpp : fix output total for mining fee calc (thanks @dexX7)
zathras-crypto Apr 11, 2015
913522d
Script: use independent solver for script identification
dexX7 Apr 11, 2015
8409388
Script: test solver with several OP_RETURN sizes via unit tests
dexX7 Apr 12, 2015
ecb57e1
Merge pull request #62 from dexX7/oc-0.10-pr-13-safe-script
zathras-crypto Apr 12, 2015
7e7bd5d
Encoding: test payload creation of known references via unit tests
dexX7 Apr 10, 2015
38dbbaa
Encoding: test existence of class C marker via unit tests
dexX7 Apr 11, 2015
4d52ad1
Encoding: test class C embedding of empty payload via unit tests
dexX7 Apr 13, 2015
a9d6f67
Encoding: fix overflow in class C size check, refine includes
dexX7 Apr 13, 2015
7a62a01
Encoding: add encoding documentation and refine code consistency
dexX7 Apr 13, 2015
fd6cd48
Encoding: provide access to the Exodus address
dexX7 Apr 15, 2015
c1de71c
Merge pull request #63 from dexX7/oc-0.10-pr-13-encoding-overhaul
zathras-crypto Apr 17, 2015
28aa37b
Merge branch 'omnicore-0.0.10' of github.com:OmniLayer/omnicore into …
zathras-crypto Apr 24, 2015
c191053
RPC encoding : apply min accept fee for target sell in senddexaccept_…
zathras-crypto Apr 24, 2015
3d7459d
Change unsafe trade detection and add override
zathras-crypto Apr 28, 2015
bea8670
senddexsell : allow zero for minimum accept fee
zathras-crypto Apr 28, 2015
68bf76c
Merge branch 'omnicore-0.0.10' of github.com:OmniLayer/omnicore into …
zathras-crypto May 5, 2015
544ee18
mastercore_sp.h: fix missing include for incomplete type CBitcoinAddress
zathras-crypto May 5, 2015
bea3705
RPC: fix sendtrade_OMNI on @dexX7's recommendations
zathras-crypto May 5, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ OMNICORE_H = \
mastercore_script.h \
mastercore_sp.h \
mastercore_tx.h \
mastercore_version.h
mastercore_version.h \
omnicore_encoding.h \
omnicore_createpayload.h \
omnicore_rpctx.h \
omnicore_utils.h

OMNICORE_CPP = \
mastercore.cpp \
Expand All @@ -180,7 +184,11 @@ OMNICORE_CPP = \
mastercore_script.cpp \
mastercore_sp.cpp \
mastercore_tx.cpp \
mastercore_version.cpp
mastercore_version.cpp \
omnicore_encoding.cpp \
omnicore_createpayload.cpp \
omnicore_rpctx.cpp \
omnicore_utils.cpp

BITCOIN_CORE_H += \
$(OMNICORE_H)
Expand Down
6 changes: 6 additions & 0 deletions src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ endif

# Omni Core extensions
OMNICORE_TESTS = \
test/mastercore_create_payload_tests.cpp \
test/mastercore_encoding_c_tests.cpp \
test/mastercore_obfuscation_tests.cpp \
test/mastercore_rounduint64_tests.cpp \
test/mastercore_script_dust_tests.cpp \
test/mastercore_script_extraction_tests.cpp \
test/mastercore_script_solver_tests.cpp \
test/mastercore_strtoint64_tests.cpp \
test/mastercore_swapbyteorder_tests.cpp

Expand Down
1,315 changes: 447 additions & 868 deletions src/mastercore.cpp

Large diffs are not rendered by default.

25 changes: 20 additions & 5 deletions src/mastercore.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#ifndef _MASTERCOIN
#define _MASTERCOIN 1

class CBitcoinAddress;
class CBlockIndex;
class CTransaction;

Expand Down Expand Up @@ -52,6 +53,14 @@ int const MAX_STATE_HISTORY = 50;
#define FORMAT_BOOST_TXINDEXKEY "index-tx-%s"
#define FORMAT_BOOST_SPKEY "sp-%d"

// Omni Layer Transaction Class
#define OMNI_CLASS_A 1
#define OMNI_CLASS_B 2
#define OMNI_CLASS_C 3

// Maximum number of keys supported in Class B
#define CLASS_B_MAX_SENDABLE_PACKETS 2

// Master Protocol Transaction (Packet) Version
#define MP_TX_PKT_V0 0
#define MP_TX_PKT_V1 1
Expand All @@ -61,6 +70,7 @@ int const MAX_STATE_HISTORY = 50;

#define MAX_SHA256_OBFUSCATION_TIMES 255

#define MIN_PAYLOAD_SIZE 8
#define PACKET_SIZE_CLASS_A 19
#define PACKET_SIZE 31
#define MAX_PACKETS 64
Expand Down Expand Up @@ -114,6 +124,7 @@ enum BLOCKHEIGHTRESTRICTIONS {
MSC_BET_BLOCK = 999999,
MSC_MANUALSP_BLOCK= 323230,
P2SH_BLOCK = 322000,
OP_RETURN_BLOCK = 999999
};

enum FILETYPES {
Expand Down Expand Up @@ -153,7 +164,11 @@ std::string FormatMP(unsigned int, int64_t n, bool fSign = false);
uint256 send_MP(const string &FromAddress, const string &ToAddress, const string &RedeemAddress, unsigned int PropertyID, uint64_t Amount);
int64_t feeCheck(const string &address);

const std::string ExodusAddress();
/** Returns the Exodus address. */
const CBitcoinAddress ExodusAddress();

/** Used to indicate, whether to automatically commit created transactions. */
extern bool autoCommit;

extern CCriticalSection cs_tally;

Expand Down Expand Up @@ -392,6 +407,8 @@ extern uint64_t global_balance_reserved_testeco[100000];
int64_t getMPbalance(const string &Address, unsigned int property, TallyType ttype);
int64_t getUserAvailableMPbalance(const string &Address, unsigned int property);
bool IsMyAddress(const std::string &address);
bool isRangeOK(const uint64_t input);
int pendingAdd(const uint256 &txid, const string &FromAddress, unsigned int propId, int64_t Amount, int64_t type, const string &txDesc);

string getLabel(const string &address);

Expand Down Expand Up @@ -429,10 +446,8 @@ bool isCrowdsalePurchase(uint256 txid, string address, int64_t *propertyId = NUL
bool isMPinBlockRange(int starting_block, int ending_block, bool bDeleteFound);
std::string FormatIndivisibleMP(int64_t n);

int ClassB_send(const string &senderAddress, const string &receiverAddress, const string &redemptionAddress, const std::vector<unsigned char> &data, uint256 & txid, int64_t additional = 0);

uint256 send_INTERNAL_1packet(const string &FromAddress, const string &ToAddress, const string &RedeemAddress, unsigned int PropertyID, uint64_t Amount,
unsigned int PropertyID_2, uint64_t Amount_2, unsigned int TransactionType, int64_t additional, int *error_code = NULL);
int ClassAgnosticWalletTXBuilder(const string &senderAddress, const string &receiverAddress, const string &redemptionAddress,
int64_t referenceAmount, const std::vector<unsigned char> &data, uint256 & txid, string &rawHex, bool commit);

bool isTestEcosystemProperty(unsigned int property);
bool isMainEcosystemProperty(unsigned int property);
Expand Down
3 changes: 2 additions & 1 deletion src/mastercore_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ enum MPRPCErrorCode
MP_INSUF_FUNDS_APENDI = -2, // balance after pending
MP_INPUT_NOT_IN_RANGE = -11, // input value larger than supported

//ClassB_send
//ClassAgnostic_send
MP_INPUTS_INVALID = -212,
MP_ENCODING_ERROR = -250,
MP_REDEMP_ILLEGAL = -233,
MP_REDEMP_BAD_KEYID = -220,
MP_REDEMP_FETCH_ERR_PUBKEY = -221,
Expand Down
Loading