Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
236 commits
Select commit Hold shift + click to select a range
d924a50
invalidate sell offer with zero bitcoin amount desired
grazcoin Mar 2, 2014
2803ab4
update reserved funds of old sell offer when accept expires
grazcoin Mar 3, 2014
3bd12d6
update icon color on sell offer after alarm check properly
grazcoin Mar 3, 2014
3660b98
typo is sell offer icon text
grazcoin Mar 3, 2014
86c8957
fix reversed sell offer order on bitcoin payment
grazcoin Mar 4, 2014
5bf78c9
fix bitcoin payment parsing with multiple inputs
grazcoin Mar 6, 2014
308e59c
allow zero bitcoins sell offer for action cancel
grazcoin Mar 6, 2014
fcf8b5c
check previous payments on check_bitcoin_payment
grazcoin Mar 6, 2014
0b0b032
add support for multiple payment on a single accept offer
grazcoin Mar 9, 2014
6299588
add amount bought to bitcoin payment parsing
grazcoin Mar 9, 2014
75029a0
include currency variable on all btcpayment links
grazcoin Mar 9, 2014
de20ec3
on multiple payments to accept list, skip exhausted accepts
grazcoin Mar 9, 2014
cad5aca
fix enforcement of minimal fee on sell accept
grazcoin Mar 12, 2014
08b46cc
invalidate multiple concurrent accepts from the same address
grazcoin Mar 12, 2014
80e08ca
set distributed exchange feature active starting at 290630 block
grazcoin Mar 12, 2014
ef01b66
update title of orderbook
grazcoin Mar 13, 2014
6d2d613
allow sell offer with zero amount when it is a cancel request
grazcoin Mar 14, 2014
1ab425b
invalidate tx with empty from address
grazcoin Mar 16, 2014
bc2fa43
allow case of different reserved funds and accepted on sell offer update
grazcoin Mar 16, 2014
7cff5c7
update timestamps to be only in browser's local time
grazcoin Mar 17, 2014
396ab89
invalidate tx with multiple outputs to exodus
grazcoin Mar 20, 2014
ebc0b99
allow usage of uncompressed pubkey for creating a sell order
grazcoin Mar 21, 2014
7401cb0
avoid google translation and caching of html pages
grazcoin Mar 21, 2014
5b88b01
Merge pull request #1 from grazcoin/master
achamely Mar 21, 2014
bec669c
bugfix: correct expiration of multiple accept offers that expire on a…
grazcoin Mar 23, 2014
4eb7576
Merge pull request #2 from grazcoin/master
achamely Mar 23, 2014
6927f27
Merge branch 'json' of https://github.com/grazcoin/mastercoin-tools i…
Mar 31, 2014
907dd78
inital stub of parsing code
khan-faiz Mar 31, 2014
e98a885
add tx 50 parsing
khan-faiz Apr 1, 2014
1d50cfe
Added fixes based on repo owner's input, invalid if hexlength too sma…
khan-faiz Apr 1, 2014
e0b71cb
Added else so decision tree is consistent
khan-faiz Apr 1, 2014
60293f6
add initial validation
khan-faiz Apr 1, 2014
faf9765
spelling errors
khan-faiz Apr 1, 2014
f24a699
Add correction to properties dict and fix fields for validation
khan-faiz Apr 1, 2014
b94e7e7
Better exception handling and error reporting
khan-faiz Apr 1, 2014
3830397
Add balances for addresses, expand some checks to include smart prope…
khan-faiz Apr 1, 2014
0db5232
Change currency_str to Smart Property for validation
khan-faiz Apr 1, 2014
deb5728
revert addr init and use separate SP init
khan-faiz Apr 2, 2014
789c37f
adds ecosystem check, prop_id naming scheme
khan-faiz Apr 2, 2014
eb318d2
Merge pull request #13 from faizkhan00/msc_parsing_
Apr 3, 2014
0e4c28d
Merge pull request #16 from faizkhan00/msc_parsing_and_balances
Apr 3, 2014
6fe40d9
Add support for TX51
khan-faiz Apr 3, 2014
df6d9e0
Mark transactions invalid if they have invalid fields or incorrect/no…
khan-faiz Apr 3, 2014
db399a9
Add smart property script tools
khan-faiz Apr 3, 2014
e4358ff
add readme
khan-faiz Apr 3, 2014
b986ae7
Rename tx-hash to prop_id, renumber starting propID for TMSC ecosystem,
khan-faiz Apr 3, 2014
e313c26
Merge pull request #18 from faizkhan00/msc_parsing_and_balances
Apr 4, 2014
c12362b
inital balances for sends
khan-faiz Apr 4, 2014
fda303c
Add link to ReadTheDocs
ripper234 Apr 5, 2014
9b93731
clarify logic for extracting property IDs and lookups
khan-faiz Apr 8, 2014
dec4080
Merge pull request #21 from faizkhan00/msc_parsing_and_balances
Apr 8, 2014
bc355da
inital commit of sends fundraiser
khan-faiz Apr 8, 2014
5578ba5
inital pass of fundraiser send
khan-faiz Apr 9, 2014
5416020
addresses #17
khan-faiz Apr 9, 2014
c1c4517
Merge branch 'master' of github.com:mastercoin-MSC/mastercoin-tools i…
khan-faiz Apr 11, 2014
e50cf6b
Add proper force to TX51
khan-faiz Apr 11, 2014
562f2f1
Add support for TX53
khan-faiz Apr 11, 2014
d59532e
Merge pull request #22 from faizkhan00/msc_sending_fundraiser
Apr 11, 2014
aa61b29
add cancellation parsing
khan-faiz Apr 11, 2014
48d80ad
inital commit of premine and bonus calculations, haven't done final p…
khan-faiz Apr 14, 2014
016c2a3
Tweaked needed funds calculation.
khan-faiz Apr 15, 2014
2945e49
Made the readme file upper-case so it lines up with what github is ex…
Apr 15, 2014
bf083c7
Updated README for the issuance scripts.
Apr 15, 2014
ec4d3cc
If a transaction references a smart property that doesn't exist on an…
Apr 15, 2014
ae5a717
Add fundraiser invalidation if one already exists
khan-faiz Apr 15, 2014
08c97f8
Error lines AFTER the return lines don't help at all.
Apr 15, 2014
ae444ed
fix initial
khan-faiz Apr 15, 2014
71d9170
Update README.md
Apr 15, 2014
e86370e
Adjusted TX50 script so that it automatically converts to satoshis wh…
Apr 15, 2014
81d5f27
second round of checks for premine to issuer
khan-faiz Apr 15, 2014
81fc887
Automatically convert number of properties to award in TX51 to satosh…
Apr 16, 2014
f819521
Adjusted price reporting in TX51 script.
Apr 16, 2014
5b71c9e
Updated the README with instructions for issuing a crowdsale.
Apr 16, 2014
f6edfac
Merge pull request #23 from faizkhan00/msc_cancellation
Apr 16, 2014
cb62e4e
Merge pull request #26 from curtislacy/msc_sp_scripts
Apr 16, 2014
9eefa4f
Merge pull request #27 from curtislacy/Handle-Missing-Properties
Apr 16, 2014
df3e6b1
Merge pull request #28 from curtislacy/Invalid-Smart-Property-Fields
Apr 16, 2014
1f33384
Merge pull request #29 from faizkhan00/msc_add_fundraiser_premine_and…
Apr 16, 2014
79cc640
Corrected a typo in the insufficient funds error message.
Apr 16, 2014
e1813f5
Merge pull request #30 from curtislacy/Correct-Typo
Apr 16, 2014
0317088
Merge pull request #31 from faizkhan00/parsefix
Apr 16, 2014
c7f48cd
Move marking fundraisers as invalid earlier so they don't clutter the…
khan-faiz Apr 16, 2014
cdbf4dd
Merge pull request #32 from faizkhan00/msc_maintain_properties_consis…
Apr 16, 2014
7220004
prevent unicode blowups
khan-faiz Apr 16, 2014
4f01416
Revert "prevent unicode blowups"
khan-faiz Apr 16, 2014
e75de0a
Fix smart property parsing behavior when erroring out, mark transacti…
khan-faiz Apr 16, 2014
3b05e92
try local rpc then look for remote file config ~/.bitcoin/bitcoin.conf
achamely Apr 16, 2014
f8bb9df
Merge pull request #33 from faizkhan00/msc_maintain_properties_consis…
Apr 17, 2014
250e595
Add file info for remote bitcoin
achamely Apr 17, 2014
2a39b17
Formatting
achamely Apr 17, 2014
f0d70b3
Readme clarity
achamely Apr 17, 2014
2434d29
Merge pull request #34 from achamely/master
Apr 17, 2014
1f18055
invalidate bad sends
khan-faiz Apr 17, 2014
5d60634
add dehexification for unicode strings
khan-faiz Apr 17, 2014
2e1cb04
fix issuance script to not have odd-length unicode
khan-faiz Apr 17, 2014
bb85741
Merge pull request #35 from faizkhan00/msc_maintain_properties_consis…
Apr 17, 2014
22b0ab2
Critical fix to ensure parsed fields are using fixed length instead o…
khan-faiz Apr 17, 2014
64d2dc1
Switched to using obelisk to submit transactions, rather than blockch…
Apr 17, 2014
7949785
Merge pull request #36 from faizkhan00/msc_maintain_properties_consis…
Apr 18, 2014
d6e7600
Merge pull request #37 from curtislacy/Switch-To-Obelisk
Apr 18, 2014
3de207f
Fixed some "insufficient funds" checks and error messages in the TX53…
Apr 18, 2014
a99ee71
Added instructions for closing a crowdsale manually.
Apr 18, 2014
8c4ef0b
Merge pull request #38 from curtislacy/Try-Close-Crowdsale
Apr 18, 2014
8b766e5
add currencydesired check, ecosystem check, fundraiser_send flag, imp…
khan-faiz Apr 18, 2014
9f7579f
Copied redeemMultiSig.py
Apr 18, 2014
fbcbf9e
Merge pull request #39 from faizkhan00/msc_maintain_properties_consis…
Apr 18, 2014
99e62e4
Added instructions for redeeming escrows.
Apr 18, 2014
1a19aee
Merge pull request #40 from curtislacy/Redeem-Multisigs
Apr 19, 2014
82fbd0e
Applied fix for https://github.com/mastercoin-MSC/mastercoin-tools/is…
khan-faiz Apr 21, 2014
15576c0
If getting a single transaction from obelisk fails, try again in case…
khan-faiz Apr 21, 2014
6fc7af4
When querying block height, output values, or transaction content fro…
khan-faiz Apr 21, 2014
9934b50
Added a secondary exodus deadline, as described in https://github.com…
khan-faiz Apr 21, 2014
1a077c3
Added a script to repair our history if we've started to creep out of…
khan-faiz Apr 21, 2014
bac75a5
Merge #41.
Apr 21, 2014
715ac37
Merge #43.
Apr 21, 2014
3848a23
Consensus fixes and whatever.
Apr 22, 2014
78604ef
Updated the "go-live" block.
Apr 22, 2014
005c76b
Merge pull request #44 from grazcoin/json
Apr 23, 2014
ef1af76
Add parsing fix for smart property (rjust for cID < 8000001) and the…
khan-faiz Apr 25, 2014
f9ee537
additional debugging
achamely Apr 29, 2014
a0796cc
Validate inputs/additional debug/error checking
achamely Apr 29, 2014
96b8f6f
P2SH invalidation fix *Critical*
khan-faiz Apr 30, 2014
0d03f5e
remove extraneous debug print
achamely Apr 30, 2014
057af7e
Merge pull request #45 from faizkhan00/hotifix_apply
Apr 30, 2014
bd855d7
Fixed identation
Nevtep Apr 30, 2014
684d5df
Allow 2-of-2, 2-of-3, 3-of-3 multisig
dexX7 May 2, 2014
18c5a63
Filter pay-to-pubkey-hash and multisig outputs
dexX7 May 2, 2014
e7b1e10
Already taken care of in is_accepted_output
dexX7 May 2, 2014
e44cebb
Reference output selection adjustments
dexX7 May 2, 2014
bad246f
Fix script for multisig
dexX7 May 2, 2014
7ef54a4
Allow change output
dexX7 May 2, 2014
c40371d
Input selection for class B transactions
dexX7 May 2, 2014
e6d7dba
Fixed spacing
dexX7 May 2, 2014
c611e5a
Fetch output based on txid:n
dexX7 May 2, 2014
6458bef
Filter output type in input selection
dexX7 May 2, 2014
fe1b3de
Catch case with no valid input at all
dexX7 May 2, 2014
bd0ac02
Seperate output type check, allow multiple Exodus outputs
dexX7 May 2, 2014
689d787
Handle empty result for tx fetching more properly
dexX7 May 2, 2014
171e389
Retry to fetch tx, if assertion error
dexX7 May 2, 2014
015e201
Make sure one valid input exists, move output validation
dexX7 May 2, 2014
45bb5d5
Define multisig output looser
dexX7 May 2, 2014
f5d382f
Merge pull request #48 from Nevtep/master
achamely May 2, 2014
d493349
Cast for safety, minor adjustments
dexX7 May 4, 2014
406915a
Remove and replace deprecated parts
dexX7 May 4, 2014
87ed0a2
Proper handling of Exodus transactions
dexX7 May 4, 2014
b7692cc
Remove unnecessary files
dexX7 May 4, 2014
5b099c8
Adjust, so overall difference is smaller
dexX7 May 4, 2014
8402715
Fix method names
dexX7 May 4, 2014
55538e3
update bootstrap to include chain field
grazcoin Apr 3, 2014
97ec933
bugfix: set invalid field after parsed dict is created
khan-faiz May 5, 2014
9806dbb
Merge pull request #49 from dexX7/cleanup
achamely May 5, 2014
126676d
Merge pull request #51 from faizkhan00/master_merge
achamely May 5, 2014
a3fa7a0
add check for invalid multisig output
achamely May 7, 2014
b4498e1
add check for invalid multisig output
achamely May 7, 2014
3835ee8
merge dexx's changes
khan-faiz May 8, 2014
513715d
invalidate non script paytopubkeyhash inputs
khan-faiz May 8, 2014
a33c253
merge with upstream, removed input selection with 'select_input_refer…
khan-faiz May 8, 2014
791ef00
Merge pull request #54 from faizkhan00/master_merge
achamely May 8, 2014
f2e660c
Move archive options to the top
dexX7 May 8, 2014
5afc48b
Remove (unused) method get_tx_method
dexX7 May 8, 2014
d7af6e1
Add comments, fix indentations
dexX7 May 8, 2014
5b3686f
Consistent indentations and usage of inverted commas
dexX7 May 8, 2014
f5c92a1
Except all instead of only TypeError in is_pubkey_valid
dexX7 May 8, 2014
68191dc
Replace get_address_of_pubkey
dexX7 May 8, 2014
2c6e0b9
Remove redundant input selection and checks
dexX7 May 8, 2014
9e835dc
Return message, if multisig is disabled
dexX7 May 8, 2014
6fceedb
Use MAX_PUBKEY_IN_BIP11 instead of magic numbers
dexX7 May 8, 2014
3870303
Invalidate transaction instead of parsing stop
dexX7 May 8, 2014
e4a1e8f
Drop examine_outputs in class B parsing
dexX7 May 8, 2014
002532d
Merge pull request #55 from dexX7/fix-input-parsing-clean
achamely May 8, 2014
9c42ba2
remove debug lines
khan-faiz May 9, 2014
5395187
Merge pull request #57 from faizkhan00/master_merge
achamely May 9, 2014
194b40a
Widen error checking for send script
achamely May 9, 2014
441e641
add silent flag for [I] lines
khan-faiz May 10, 2014
aa6566b
Add silent check for [I] logging, initialization to utils_general.py
khan-faiz May 10, 2014
e1f289b
add silent flag check to URL and block height printing in utils_obeli…
khan-faiz May 10, 2014
978a312
Add -D flag to dump data at a specific block, added -s flag for silen…
khan-faiz May 10, 2014
34ef55c
Add fix for address dumps
khan-faiz May 10, 2014
cdd2bbd
Merge pull request #58 from faizkhan00/add_dumper
achamely May 12, 2014
c074f3c
Format "formatted_amount_accepted"
dexX7 May 14, 2014
cc9e02c
Add parsing lag fix
khan-faiz May 17, 2014
5f1ed3b
Add dust sig 5757 to distinguish omni txes
khan-faiz May 17, 2014
5d727e7
correct sending of error up to user based on check
khan-faiz May 17, 2014
008d90b
try sending to the network if we don't find the input, since it may s…
khan-faiz May 17, 2014
b2a548d
Merge pull request #60 from faizkhan00/master_merge
achamely May 17, 2014
bb7c134
Merge pull request #61 from faizkhan00/dust_sig
achamely May 17, 2014
f9d2598
Merge pull request #62 from faizkhan00/fix_badinput_check
achamely May 17, 2014
cf03f65
Resolve duplicate coin names with a random integer attachment to avoi…
khan-faiz Jun 5, 2014
5c318e4
Change random ID to property ID
khan-faiz Jun 5, 2014
05bf3a2
Merge pull request #65 from faizkhan00/duplicate_coinname_same_coin
achamely Jun 5, 2014
9ac0289
Merge pull request #59 from dexX7/format_accepted_amount
achamely Jun 5, 2014
54ee86b
Merge pull request #42 from curtislacy/Repair-Script
achamely Jun 5, 2014
90ca741
Add status msgs
khan-faiz Jun 11, 2014
f376eaf
fix status message
khan-faiz Jun 11, 2014
98facec
Merge branch 'master' of https://github.com/mastercoin-MSC/mastercoin…
achamely Jun 11, 2014
87bcd3a
Add Hexspace abstraction
achamely Jun 11, 2014
fdd3bb4
Add timeout to sx history command, 60 seconds, signal 9 kill
khan-faiz Jun 12, 2014
d962bd3
Merge pull request #67 from faizkhan00/fix-hung-history-proc
achamely Jun 12, 2014
cbb6afb
Add global TIMEOUT variable to both sx history and sx balance
khan-faiz Jun 12, 2014
5abb28f
Add global timeout to every call to Sx
khan-faiz Jun 12, 2014
afe44cd
Merge pull request #68 from faizkhan00/fix-hung-history-proc
achamely Jun 12, 2014
240ef97
Merge pull request #70 from faizkhan00/add-status-msgs-parser
achamely Jun 12, 2014
5c41a12
Bugfix LongInt encoding, Bugfix Duplicate Input list
achamely Jun 13, 2014
60d648b
Merge branch 'master' of https://github.com/mastercoin-MSC/mastercoin…
achamely Jun 13, 2014
6a0fb23
Make sure for fundraisers, if deadline is past, invalidate
khan-faiz Jun 27, 2014
c03627f
Merge pull request #71 from faizkhan00/fix-deadline
Jun 27, 2014
93d2caa
check milliseconds for deadline
khan-faiz Jun 27, 2014
d5d18c1
Merge pull request #72 from faizkhan00/fix-deadline
faizkhan00 Jun 27, 2014
fb276ce
Make sure to truncate the tokens awarded to issuer individually
khan-faiz Jun 28, 2014
4744633
Merge pull request #73 from faizkhan00/fix-premine-truncate
faizkhan00 Jun 28, 2014
6164303
Fix TMSC out of consensus case:
khan-faiz Jul 1, 2014
1c94727
Updated Omniwallet Balance url
achamely Jul 2, 2014
fab06cc
Merge branch 'master' of github.com:mastercoin-MSC/mastercoin-tools i…
khan-faiz Jul 3, 2014
9c95077
Keep up to date with spec changes: https://github.com/mastercoin-MSC/…
khan-faiz Jul 4, 2014
6640234
Patch for github read issue
achamely Jul 7, 2014
2added2
update pubkey method to use private key when available properly
achamely Jul 8, 2014
a7be5f1
Fix encoded amount for nondivisible properties
achamely Jul 8, 2014
db264cd
Merge remote-tracking branch 'msc/master' into add-checks
khan-faiz Jul 10, 2014
af58e39
Add prop check
khan-faiz Jul 10, 2014
8289e10
Merge pull request #74 from faizkhan00/fix-tmsc
faizkhan00 Jul 10, 2014
6ba5f5f
Merge pull request #75 from faizkhan00/add-checks
faizkhan00 Jul 10, 2014
8845a47
Ensure 0 < property_type is invalid
khan-faiz Jul 17, 2014
0144a8a
Merge pull request #76 from faizkhan00/add-checks
faizkhan00 Jul 17, 2014
970ad76
Remove btc as valid CID desired
khan-faiz Jul 30, 2014
688bd95
Merge pull request #77 from faizkhan00/add-checks
faizkhan00 Jul 30, 2014
f742354
Add fix to convert units when funding indivisible to divisible
khan-faiz Aug 2, 2014
603698f
Ensure we only try to do it for indivisible or SPs
khan-faiz Aug 2, 2014
2e6d387
Merge pull request #78 from faizkhan00/add-funding-fix
faizkhan00 Aug 3, 2014
3608b25
ensure we correctly check the currencyID for fundraiser sends
khan-faiz Aug 3, 2014
0fc8907
Make sure that we add the currency based on SP or non-SP for fundraisers
khan-faiz Aug 3, 2014
68366c2
Merge pull request #79 from faizkhan00/add-funding-fix
faizkhan00 Aug 3, 2014
3c50e88
Fix to appropriately accredit duplicate properties, ex. Test prop SP2…
khan-faiz Aug 3, 2014
d391cb7
Fix to the fix... change ints to string
khan-faiz Aug 3, 2014
fac87c0
Merge pull request #80 from faizkhan00/fix-dupes
faizkhan00 Aug 3, 2014
f580885
Add proper fee parsing
khan-faiz Sep 17, 2014
8bfba3d
Merge pull request #81 from faizkhan00/fee-fix
faizkhan00 Sep 17, 2014
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mastercoin-tools
* Package of mastercoin related tools.
* The intention is to help finalizing the mastercoin spec, and enable easy further coding.

For API documentation, please [Read The Docs](http://mastercoin-tools-installer.readthedocs.org/en/latest/).

## Based on what? ##
* The code uses the package sx, which is libbitcoin based.
Expand Down
30 changes: 0 additions & 30 deletions bootstrap_msc_per_address.py

This file was deleted.

2 changes: 0 additions & 2 deletions general/.gitignore

This file was deleted.

32 changes: 9 additions & 23 deletions msc_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,11 @@
import sys
import operator
import time
from msc_utils_bitcoin import *
from msc_utils_parsing import *

def main():

msc_globals.init()

# full story format or just csv
output_format='csv'
if len(sys.argv) > 1:
if sys.argv[1]=='story':
output_format='story' # a.k.a long format
# get all tx of exodus address
history=get_history(exodus_address)
# sort
Expand All @@ -47,20 +41,19 @@ def main():
if block_timestamp == None:
error('failed to get timestamp: '+err)
try:
tx_sec_before_deadline=exodus_bootstrap_deadline-block_timestamp
tx_sec_before_deadline=exodus_bootstrap_orig_deadline-block_timestamp
except TypeError:
error('bad block timestamp')
error('bad block timestamp')
# bonus is 10% for a week
bonus=max((tx_sec_before_deadline+0.0)/(3600*24*7*10.0)*100,0)
dacoins=str('{:.0f}'.format(int(value)*(100+bonus)))
json_tx=get_tx(tx_hash)
# give dacoins to highest contributing address.
output_dict={} # dict to collect outputs per address
for i in json_tx['inputs']:
prev_tx_hash=i['previous_output'].split(':')[0]
prev_tx_output_index=i['previous_output'].split(':')[1]
json_prev_tx=get_tx(prev_tx_hash)
output_value=json_prev_tx['outputs'][int(prev_tx_output_index)]['value']
output_value=get_value_from_output(i['previous_output'])
if output_value==None:
error('failed get_value_from_output')
if output_dict.has_key(i['address']):
output_dict[i['address']]+=output_value
else:
Expand All @@ -76,17 +69,10 @@ def main():
parsed['invalid']=False
parsed['tx_time']=str(block_timestamp)+'000'
try:
filename='tx/'+parsed['tx_hash']+'.json'
try:
f=open(filename, 'w')
f.write('[')
json.dump(parsed, f)
f.write(']\n')
f.close()
except OSError:
info("dump to file error for "+tx_hash)
filename='tx/'+parsed['tx_hash']+'.json'
atomic_json_dump(parsed, filename)
except IndexError:
info("cannot parse 'tx_hash' in "+tx_hash)
info("cannot parse 'tx_hash' in "+tx_hash)


if __name__ == "__main__":
Expand Down
2 changes: 2 additions & 0 deletions msc_globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
# globals.py

def init():
global s # silent mode
global last_block
global d # debug mode
last_block=0
d=False
s=False
55 changes: 31 additions & 24 deletions msc_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def parse():
######################################
# reading and setting options values #
######################################

info('Initializing globals...')
msc_globals.init()

parser = OptionParser("usage: %prog [options]")
Expand All @@ -40,13 +40,15 @@ def parse():
(options, args) = parser.parse_args()
msc_globals.d=options.debug_mode
single_tx=options.single_tx
archive=options.archive
requested_block_height=options.starting_block_height

# show debug on
if msc_globals.d:
debug('debug is on')

# don't bother parsing if no new block was generated since last validation
info('Determining last validated block...')
last_validated_block=0
try:
f=open(LAST_VALIDATED_BLOCK_NUMBER_FILE,'r')
Expand Down Expand Up @@ -91,18 +93,18 @@ def parse():

# to catch chain reorgs, check 5 blocks back
starting_block_height = int(starting_block_height) - 5

archive=options.archive

info('starting parsing at block '+str(starting_block_height))

if single_tx == None:
info('Retreiving history and sorting data...')
# get all tx of exodus address
history=get_history(exodus_address)
history.sort(key=output_height)
# Oddly enough this next print statement corrects the parsing-behind bug
print "Last 5 transactions of Exodus", history[-5:]
else:
# build fake history of length 1 (debug purposes)
json_tx=get_json_tx(get_raw_tx(single_tx))
json_tx=get_tx(single_tx)
marker_number=-1
marker_value=-1
i=0
Expand All @@ -129,6 +131,8 @@ def parse():

# go over transaction from all history of 1EXoDus address
last_block=0

info('Parsing transactions...')
for tx_dict in history:
value=tx_dict['value']
if starting_block_height != None:
Expand Down Expand Up @@ -158,10 +162,6 @@ def parse():
outputs_list=json_tx['outputs']
(outputs_list_no_exodus, outputs_to_exodus, different_outputs_values, invalid)=examine_outputs(outputs_list, tx_hash, raw_tx)

if invalid != None:
info(str(invalid[1])+' on '+tx_hash)
parsed['invalid']=invalid

num_of_outputs=len(outputs_list)

(block_timestamp, err)=get_block_timestamp(int(block))
Expand All @@ -184,7 +184,11 @@ def parse():
parsed['block']=str(block)
parsed['index']=str(index)
if not parsed.has_key('invalid'):
parsed['invalid']=False
if invalid != None:
info(str(invalid[1])+' on '+tx_hash)
parsed['invalid']=invalid
else:
parsed['invalid']=False
parsed['tx_time']=str(block_timestamp)+'000'
debug(str(parsed))
filename='tx/'+parsed['tx_hash']+'.json'
Expand All @@ -196,15 +200,12 @@ def parse():
try:
orig_json=json.load(f)[0]
except (KeyError, ValueError):
try:
orig_json=json.load(f)
except ValueError:
error('failed loading json from '+filename)
error('failed loading json from '+filename)
f.close()
# verify bootstrap block
if orig_json.has_key('block'):
orig_block=orig_json['block']
debug('found this tx already on (previous) block '+orig_block)
debug('found this tx already on (previous) block '+str(orig_block))
if int(orig_block)>last_exodus_bootstrap_block:
debug('but it is post exodus - ignoring')
orig_json=None
Expand All @@ -213,12 +214,9 @@ def parse():
except IOError:
pass
if orig_json != None: # it was an exodus tx
if len(orig_json)==1:
new_json=[orig_json[0],parsed]
atomic_json_dump(new_json, filename, add_brackets=False)
info('basic tx was also exodus on '+tx_hash)
else:
info('basic tx is already present on exodus on '+tx_hash)
new_json=[orig_json,parsed]
atomic_json_dump(new_json, filename, add_brackets=False)
info('basic tx was also exodus on '+tx_hash)
else:
atomic_json_dump(parsed, filename)
else: # num_of_outputs <= 2 and not multisig
Expand All @@ -243,7 +241,11 @@ def parse():
parsed['block']=str(block)
parsed['index']=str(index)
if not parsed.has_key('invalid'):
parsed['invalid']=False
if invalid != None:
info(str(invalid[1])+' on '+tx_hash)
parsed['invalid']=invalid
else:
parsed['invalid']=False
parsed['tx_time']=str(block_timestamp)+'000'
debug(str(parsed))
filename='tx/'+parsed['tx_hash']+'.json'
Expand All @@ -258,7 +260,11 @@ def parse():
parsed['block']=str(block)
parsed['index']=str(index)
if not parsed.has_key('invalid'):
parsed['invalid']=False
if invalid != None:
info(str(invalid[1])+' on '+tx_hash)
parsed['invalid']=invalid
else:
parsed['invalid']=False
parsed['tx_time']=str(block_timestamp)+'000'
debug(str(parsed))
filename='tx/'+parsed['tx_hash']+'.json'
Expand All @@ -270,7 +276,8 @@ def parse():
if single_tx == None and block != None:
msc_globals.last_block=block

rev=get_revision_dict( last_block, options.repository_path )
info('Finished, dumping last_block and revision.json...')
rev=get_revision_dict(last_block, options.repository_path)
atomic_json_dump(rev, 'www/revision.json', add_brackets=False)

if archive:
Expand Down
Loading