定价两次-同一事件在确认前再次发生

pragma solidity ^0.4.;

contract TransactionOrdering {
uint256 price;
address owner; event Purchase(address _buyer, uint256 _price);
event PriceChange(address _owner, uint256 _price); modifier ownerOnly() {
require(msg.sender == owner);
_;
} function TransactionOrdering() {
// constructor
owner = msg.sender;
price = ;
} function buy() returns (uint256) {
Purchase(msg.sender, price);
return price;
} function setPrice(uint256 _price) ownerOnly() {
price = _price;
PriceChange(owner, price);
}
}

改价失败-同一事件再次发生前就完成了流程

contract IOU{
// Approves the transfer of tokens
function approve(address _spender, uint256 _val) {
allowed[msg.sender][_spender] = _val;
return true;
}
// Transfers tokens
function transferFrom(address _from, address _to, uint256 _val) {
require(
allowed[_from][msg.sender] >= _val
&& balances[_from] >= _val
&& _val > 0);
balances[_from] -= _val;
balances[_to] += _val;
allowed [_from][msg.sender] -= _val;
return true;
}
}  

多人支付,总量不足-异步调用的问题,没能区别总成交量=目前已经完成的成交量+已经允许,但还没有callback的成交量,忽视了后面这一部分(Improper Check on Ether)

contract Casino{
function bet() payable {
// make sure we can pay out the player
if (address(this).balance < msg.value * ) throw;
bytes32 oid = oraclize_query(...); // random
bets[oid] = msg.value;
players[oid] = msg.sender;
}
function __callback(bytes32 myid, string result)
onlyOraclize onlyIfNotProcessed(myid) {
if (parseInt(result) % == )
players[myid].send( bets[myid] * );
}
}

没有在异步调用时区别身份-异步调用的返回可能是打乱顺序的

contract CasinoAltered{
function bet() payable {
// make sure we can pay out the player
if (address(this).balance < msg.value * ) throw;
bytes32 oid = oraclize_query(...); // random
bets[oid] = msg.value;
players[oid] = msg.sender;
}
function __callback(bytes32 myid, string result)
onlyOraclize onlyIfNotProcessed(myid) {
if (parseInt(result) % == )
players[myid].send( bets[bets.size() -] * );
}
}

EO bugs的更多相关文章

  1. Common Bugs in C Programming

    There are some Common Bugs in C Programming. Most of the contents are directly from or modified from ...

  2. POJ2096 Collecting Bugs

    Time Limit: 10000MS   Memory Limit: 64000K Total Submissions: 5090   Accepted: 2529 Case Time Limit: ...

  3. 【poj2096】Collecting Bugs

    题目描述 Ivan is fond of collecting. Unlike other people who collect post stamps, coins or other materia ...

  4. 与你相遇好幸运,Mongodb客户端&BUGS

    > Robomongo https://robomongo.org > 日常使用频率最高的客户端 存在BUG: 在 db.getCollection('xzq').find({" ...

  5. OAF 中的EO 和VO

    EO :oracle.apps.fnd.framework.server.OAEntityImpl VO:oracle.apps.fnd.framework.server.OAViewRowImpl ...

  6. PL/SQL EO 设计与开发

    1.INSERT 调用PL/SQL 去insert的时候,没有使用super(),此时应当自己创建callable statement: 调用checkErrors()方法在执行 callable s ...

  7. 【月末轻松篇】--- 那些奇葩的Bugs

    不能说所有的bug都是纸老虎,但往往那种看似很奇葩的bug,导致的原因确实很简单,烦了你一段时间,找到真相又让你忍不住一笑.什么是奇葩的bug呢.我的定义是:代码逻辑都一样,但在A处是好的,到了B处就 ...

  8. 【POJ2096】Collecting Bugs 期望

    [POJ2096]Collecting Bugs Description Ivan is fond of collecting. Unlike other people who collect pos ...

  9. CSS Bugs 解决方案

    说明:本文档兼容性测试基础环境为:windows系统:IE6-IE10, Firefox6.0, Chrome13.0, Safari5.1, Opera11.51 Bugs及解决方案列表(以下实例默 ...

随机推荐

  1. opencv学习之路(41)、人脸识别

    一.人脸检测并采集个人图像 //take_photo.cpp #include<opencv2/opencv.hpp> using namespace cv; using namespac ...

  2. [c/c++] programming之路(27)、union共用体

    共用体时刻只有一个变量,结构体变量同时并存 一.创建共用体的三种形式 #include<stdio.h> #include<stdlib.h> #include<stri ...

  3. 使用pynlpir增强jieba分词的准确度

    在使用jieba分词时,发现分词准确度不高.特别是一些专业词汇,比如堡垒机,只能分出堡垒,并不能分出堡垒机.这样导致的问题是很多时候检索并不准确. 经过对比测试,发现nlpir进行分词效果更好.但是n ...

  4. msgid 属性

    Android源码中的String.xml文件,msgid这个属性是干嘛的? 全局资源,方便引用.比如在布局的text和activity中用到.

  5. 单元测试系列之十一:Jmockit之mock特性详解

    本文是Jmockit学习过程中,根据官网所列的工具特性进行解读. 1.调用次数约束(Invocation count constraints) 可以通过调用计数约束来指定预期和/或允许匹配给定期望的调 ...

  6. Java 基础知识点小结

    小知识点 所有的程序,都要定义在类里面: 异常 定义方法时,使用 throws 可以用来捕获方法体内没有捕获的异常,然后以 SomeException 抛出异常 java是解释型语言.java虚拟机能 ...

  7. robotframework-ride支持python3

    最近发现robotframework的RIDE工具终于支持python3了,赶紧就安装了一下. 最新版本1.7.3.1基于wxPython4.0.4,此时的wxPython也是支持Python3.x的 ...

  8. JavaScript 随意记

    js 志异: <script> // ----- 1 --------- alert(new Date()) alert(+new Date()) </script>

  9. 使用subline作为Stata外部编辑器,并实现代码高亮

    Sublime Text 3在Stata13/14/15 代码编辑中的辅助应用   更友好的格式请见: http://dfadf0be.wiz03.com/share/s/3vHv2-0ALQZE2v ...

  10. 决策树算法原理(CART分类树)

    决策树算法原理(ID3,C4.5) CART回归树 决策树的剪枝 在决策树算法原理(ID3,C4.5)中,提到C4.5的不足,比如模型是用较为复杂的熵来度量,使用了相对较为复杂的多叉树,只能处理分类不 ...