diff --git a/doc/Specifications.md b/doc/Specifications.md deleted file mode 100644 index 6fd2352d2264c193b3e67ff5f33bc27276e2df33..0000000000000000000000000000000000000000 --- a/doc/Specifications.md +++ /dev/null @@ -1,21 +0,0 @@ -# Specifications - -## Client-side concepts - -### Account - * An account is a PGP Key - * An account can be a member of multiple communities - * An account own at least one wallet for each currency he owns - * An account can own multiple wallets of the same currency - * An account must declare the nodes he trusts to receive transactions - * An account must declare the nodes he uses to send transactions for a currency type - -### Community - * A community uses one unique currency - * A community has members - * Each members of the community can issue currency following the rule defined in the community amendment - -### Wallets - * Wallets can own only one type of currency - * Wallets value are the sum of the transactions received and sent that the user listed in this wallet - \ No newline at end of file diff --git a/doc/cutecoint_concept.ui b/doc/cutecoint_concept.ui deleted file mode 100644 index 825a9fa8d565bee64a4c6b5ef09772ff470a91b8..0000000000000000000000000000000000000000 --- a/doc/cutecoint_concept.ui +++ /dev/null @@ -1,324 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MainWindow</class> - <widget class="QMainWindow" name="MainWindow"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>452</width> - <height>400</height> - </rect> - </property> - <property name="windowTitle"> - <string notr="true">CuteCoin</string> - </property> - <widget class="QWidget" name="centralwidget"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QFrame" name="actionsFrame"> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QTabWidget" name="tabWidget"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="walletsTab"> - <attribute name="title"> - <string>Wallets</string> - </attribute> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QListWidget" name="listWidget_2"> - <item> - <property name="text"> - <string>Main wallet (uCoins)</string> - </property> - </item> - <item> - <property name="text"> - <string>Freecoins wallet (freeCoins)</string> - </property> - </item> - </widget> - </item> - <item> - <widget class="QListWidget" name="listWidget_3"> - <item> - <property name="text"> - <string>+10</string> - </property> - </item> - <item> - <property name="text"> - <string>-100</string> - </property> - </item> - <item> - <property name="text"> - <string>-30</string> - </property> - </item> - <item> - <property name="text"> - <string>+300</string> - </property> - </item> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="transactionsTab"> - <attribute name="title"> - <string>Transactions</string> - </attribute> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Sent</string> - </property> - </widget> - </item> - <item> - <widget class="QListWidget" name="listWidget"> - <item> - <property name="text"> - <string>100 to Caner Candan (0x5D2662E0F300EBAD)</string> - </property> - </item> - <item> - <property name="text"> - <string>30 to cgeek twicedd (0x399EB3415C237F93)</string> - </property> - </item> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Received</string> - </property> - </widget> - </item> - <item> - <widget class="QListWidget" name="listWidget_4"> - <item> - <property name="text"> - <string>10 from Caner Candan (0x5D2662E0F300EBAD)</string> - </property> - </item> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="communitiesTab"> - <attribute name="title"> - <string>Communities</string> - </attribute> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QTabWidget" name="tabWidget_2"> - <property name="currentIndex"> - <number>1</number> - </property> - <widget class="QWidget" name="ucoinTab"> - <attribute name="title"> - <string>Ucoin</string> - </attribute> - </widget> - <widget class="QWidget" name="freecoinTab"> - <attribute name="title"> - <string>FreeCoin</string> - </attribute> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <item> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Members</string> - </property> - </widget> - </item> - <item> - <widget class="QListWidget" name="listWidget_5"> - <item> - <property name="text"> - <string>Mister K</string> - </property> - </item> - <item> - <property name="text"> - <string>Another guy</string> - </property> - </item> - <item> - <property name="text"> - <string>Inso sonI</string> - </property> - </item> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <item> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Last issuance</string> - </property> - </widget> - </item> - <item> - <widget class="QListWidget" name="listWidget_6"> - <item> - <property name="text"> - <string>110 (27/12/2014)</string> - </property> - </item> - <item> - <property name="text"> - <string>140 (27/01/2015)</string> - </property> - </item> - <item> - <property name="text"> - <string>190 (27/02/2015)</string> - </property> - </item> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QMenuBar" name="menubar"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>452</width> - <height>20</height> - </rect> - </property> - <widget class="QMenu" name="menuTr_File"> - <property name="title"> - <string>Account</string> - </property> - <addaction name="actionChange_account"/> - <addaction name="actionManage_accounts"/> - <addaction name="actionConfigure_trustable_nodes"/> - </widget> - <widget class="QMenu" name="menuEdit"> - <property name="title"> - <string>Contacts</string> - </property> - <widget class="QMenu" name="menuCaner_Candan"> - <property name="title"> - <string>Caner Candan</string> - </property> - <addaction name="separator"/> - <addaction name="actionSend_a_message"/> - <addaction name="actionSend_money"/> - <addaction name="separator"/> - <addaction name="actionRemove_contact"/> - </widget> - <widget class="QMenu" name="menuCGeek"> - <property name="title"> - <string>cGeek</string> - </property> - <addaction name="actionSend_a_message_2"/> - <addaction name="actionSend_money_2"/> - <addaction name="separator"/> - <addaction name="actionRemove_contact_2"/> - </widget> - <addaction name="menuCaner_Candan"/> - <addaction name="menuCGeek"/> - <addaction name="separator"/> - <addaction name="actionAdd_a_contact"/> - </widget> - <addaction name="menuTr_File"/> - <addaction name="menuEdit"/> - </widget> - <widget class="QStatusBar" name="statusbar"/> - <action name="actionChange_account"> - <property name="text"> - <string>Change account</string> - </property> - </action> - <action name="actionManage_accounts"> - <property name="text"> - <string>Manage accounts</string> - </property> - </action> - <action name="actionConfigure_trustable_nodes"> - <property name="text"> - <string>Configure trustable nodes</string> - </property> - </action> - <action name="actionAdd_a_contact"> - <property name="text"> - <string>Add a contact</string> - </property> - </action> - <action name="actionSend_a_message"> - <property name="text"> - <string>Send a message</string> - </property> - </action> - <action name="actionSend_money"> - <property name="text"> - <string>Send money</string> - </property> - </action> - <action name="actionRemove_contact"> - <property name="text"> - <string>Remove contact</string> - </property> - </action> - <action name="actionSend_a_message_2"> - <property name="text"> - <string>Send a message</string> - </property> - </action> - <action name="actionSend_money_2"> - <property name="text"> - <string>Send money</string> - </property> - </action> - <action name="actionRemove_contact_2"> - <property name="text"> - <string>Remove contact</string> - </property> - </action> - </widget> - <resources/> - <connections/> -</ui> diff --git a/doc/uml/models.png b/doc/uml/models.png deleted file mode 100644 index a4314ae24e7027f32e61959c854ac9f5ceb327ba..0000000000000000000000000000000000000000 Binary files a/doc/uml/models.png and /dev/null differ diff --git a/doc/uml/models.pu b/doc/uml/models.pu deleted file mode 100644 index 82a546ca685ae3669e1d4a6a893d90b8a7bb38f8..0000000000000000000000000000000000000000 --- a/doc/uml/models.pu +++ /dev/null @@ -1,46 +0,0 @@ -@startuml - -#TODO: Rework UML with all informations gathered lately - -class Account { - pgpkey -} - -Account --> "0..*" Community : is a member of -Account --> "0..*" Node : trusts -Account --> "0..*" Node : send transactions with -Account --> "*" Transaction : send -Account --> "*" Transaction : receive -Account --> "0..*" Wallet : owns - -class Community { -} - -Community "1" -- "1" Currency : uses -Community "1" --> "1..*" Node : known nodes - -class Node { - address - port - auth -} - -Node --> "1" Community - -class Transaction { - value - currency - sender - receiver -} - -class Wallet { - currency - coins -} - - - -@enduml - - diff --git a/doc/uml/tx_lifecycle.png b/doc/uml/tx_lifecycle.png new file mode 100644 index 0000000000000000000000000000000000000000..0e7061b3438870f7c6a7c4fae11a191f971e9234 Binary files /dev/null and b/doc/uml/tx_lifecycle.png differ diff --git a/doc/uml/tx_lifecycle.pu b/doc/uml/tx_lifecycle.pu new file mode 100644 index 0000000000000000000000000000000000000000..c8e9c700e198ed309be36ea67026af65fde6d0fa --- /dev/null +++ b/doc/uml/tx_lifecycle.pu @@ -0,0 +1,10 @@ +@startuml + +[*] --> To_send +To_send --> Awaiting : Broadcasted at B +Awaiting --> Validated : Registered in [B; B+15] +Awaiting --> Canceled : Not registered in [B; B+15] +Canceled --> To_send : Send back order +Canceled --> Dropped : Drop order + +@enduml \ No newline at end of file diff --git a/src/cutecoin/core/wallet.py b/src/cutecoin/core/wallet.py index 87121814f28c0488d74996118a8eada4336da217..925da2a997ada03157861c43e8496b047309f729 100644 --- a/src/cutecoin/core/wallet.py +++ b/src/cutecoin/core/wallet.py @@ -19,14 +19,15 @@ class Cache(): self.wallet = wallet self.tx_sent = [] - self.awaiting_tx = [] + self.tx_awaiting = [] self.tx_received = [] + self.tx_to_send = [] self.available_sources = [] def load_from_json(self, data): self.tx_received = [] self.tx_sent = [] - self.awaiting_tx = [] + self.tx_awaiting = [] logging.debug(data) data_received = data['received'] @@ -39,7 +40,7 @@ class Cache(): data_awaiting = data['awaiting'] for s in data_awaiting: - self.awaiting_tx.append((r['block'], Transaction.from_signed_raw(s['raw']))) + self.tx_awaiting.append((r['block'], Transaction.from_signed_raw(s['raw']))) if 'sources' in data: data_sources = data['sources'] @@ -58,7 +59,7 @@ class Cache(): data_sent.append({'block': r[0], 'raw': s[1].signed_raw()}) data_awaiting = [] - for s in self.awaiting_tx: + for s in self.tx_awaiting: data_awaiting.append({'block': r[0], 'raw': s[1].signed_raw()}) data_sources = [] @@ -76,7 +77,7 @@ class Cache(): return self.tx_sent def awaiting(self, community): - return self.awaiting_tx + return self.tx_awaiting def latest_received(self, community): return self.tx_received @@ -117,7 +118,7 @@ class Cache(): if len(in_inputs) > 0: # remove from waiting transactions list the one which were # validated in the blockchain - self.awaiting_tx = [awaiting[1] for awaiting in self.awaiting_tx + self.tx_awaiting = [awaiting[1] for awaiting in self.tx_awaiting if awaiting[1].compact() != tx.compact()] self.tx_sent.append((block_number, tx)) @@ -262,7 +263,7 @@ class Wallet(object): community.broadcast(bma.tx.Process, post_args={'transaction': tx.signed_raw()}) block_number = community.current_blockid()['number'] - self.caches[community.currency].awaiting_tx.append((block_number, tx)) + self.caches[community.currency].tx_awaiting.append((block_number, tx)) except: raise